# Generating a resource roots

## Getting Root concept

Root concepts retrieved by the def roots method in ontologies_linked_data/models/ontology_submission.rb ​

* If this is not a SKOS ontology: it retrieves owl:Thing

  ```ruby
  owlThing = Goo.vocabulary(:owl)["Thing"] 
  ```
* If this is a SKOS ontology: it retrieves the skos:hasTopConcept of the scheme


### More details on SKOS


:::info
[https://www.w3.org/TR/skos-reference](https://www.w3.org/TR/skos-reference%5D())

:::

**Paragraph "4.6.3. Top Concepts and Semantic Relations"**:  The property skos:hasTopConcept is, by convention, used to link a concept scheme to the SKOS concept(s) which are topmost in the hierarchical relations for that scheme. However, there are no integrity conditions enforcing this convention. Therefore, the graph below, whilst not strictly adhering to the usage convention for skos:hasTopConcept, is nevertheless consistent with the SKOS data model.

```sql
<MyScheme> skos:hasTopConcept <MyConcept> .
<MyConcept> skos:broader <AnotherConcept> .
<AnotherConcept> skos:inScheme <MyScheme> .

#Testing on BioPortal SPARQL

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?root WHERE {
GRAPH <http://data.bioontology.org/ontologies/CO_325/submissions/1> {
?x skos:hasTopConcept ?root .
}}
```


## Code source


:::info
<https://github.com/ontoportal-lirmm/ontologies_linked_data/blob/master/lib/ontologies_linked_data/models/ontology_submission.rb#L2202>

:::


## Process modelization

 ![](https://wiki.agroportal.eu/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2MyODRmYzA0LTA4ZmUtNGE1Yi05ODM4LWM5MjhmYTFlNjhjNi9hYjg2YzY2OS1jNTQwLTRlNmQtOTFjMS05YjExNTg3YmE5ZTEvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTM4OTQ0MDAsImV4cCI6MTc5Mzk4MDgwMH0.uH7vYQahRS-49SomFxpJB4tSjzAUTWYM-bu9PMTO7IA " =561x1101")


Source: <https://app.diagrams.net/#G1DNkAkL2Vw7ed4_jciPHCsrrY790qdH3y>

---

**Documents**

- [💁‍♂️ Acknowledgments](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/acknowledgments-15GdRXLQdm)
- [📚Publications and references](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/publications-and-references-87tEoeoGKy)
- [🗽Terms & Conditions](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/terms-conditions-naDsDo2Zxq)
- [🧞‍♂️Metadata guidelines and recommendations](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/metadata-guidelines-and-recommendations-pOFbK9sIfp)
- [📜 AgroPortal Release Notes](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/agroportal-release-notes-btKjZk5tU2)
- [ 👩‍🚀 User Guide](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/user-guide-ZszoBwfjGF)
- [📎 API Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/api-documentation-kMCurGKD97)
- [🤖 Developer Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/developer-documentation-LhsrucqGTa)
- [🗃External Documentation](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/external-documentation-vNPQCdArrr)
- [AgroPortal infrastructure](https://wiki.agroportal.eu/s/e6158eda-c109-4385-852c-51a42de9a412/doc/agroportal-infrastructure-ietsAU4kPs)