mmisw / orr-portal

ORR Frontend component
Apache License 2.0
8 stars 5 forks source link

suggested enhanced SPARQL queries #118

Closed graybeal closed 5 years ago

graybeal commented 6 years ago

some suggested real-world problems that might prove suitable for better SPARQL examples. Major categories of problem (first two are geeky and generic, then it gets more real-word).

Ontology Discovery A.1 List all available ontologies. A.2 Find ontologies with certain metadata attribute characteric(s). A.3 Find ontologies with certain content (say in name or description). A.4. Find all the ontologies that address a particular topic. (Oh! if only there were a Resource Type keyword!) A.5 Find ontologies (?not)updated since date. (A subitem of A.2, I suppose.) A.6 For any of above, show count instead of or in addition to list.

Ontology Content Discovery B.1 List all classes/properties/instances in ontology. B.2 List all annotations with particular class as subject or object. B.3 Discover top-level classes (there is no standard way to do this, but SKOS at least has a declaration that could be used, and BioPortal assigns some property to what it thinks are top-level (root) classes. B.4 Discover sub-classes or individuals of a given class. (SKOS equivalent: narrower terms) B.5 Discover super-classes (up the hierarchy) of a given class. (SKOS equivalent: broader terms) B.6 Find all synonyms of a given class or property. (SKOS equivalent: close match) B.7 Find related terms (SKOS related match). B.8 For any of B.1, B.3-B.7, show Labels instead of URIs. B.9 Find any terms that occur only once in an ontology. B.10 Discover all occurrences of a concept within an ontology.

Ontology Relations C.1 Show all mappings between two ontologies. C.2 Show all overlapping concepts (same concept in both) between two ontologies. C.3 For above, show count instead of or in addition to list. C.4 Same as C.1-C.2, for more than two ontologies. C.5 Discover/count all occurrences of a term in all ontologies.

Find concepts satisfying a real-world meaning (within ontology and/or across ontologies)

Providing a pair of examples to distinguish between looking within an ontology, and one that does not, will be useful. Your idea of using the path seems like the right way to start.

D.1 Find all (?SWEET) entities(class or individual) that are a type of a particular thing. See examples 2 and 5 in first comment below. The real-world topics, even just in SWEET, may be expressed in various contexts in the ontology, I'm not sure. D.2 Find and list inferred path(s) between two concepts. (Probably not supported in ORR, without reasoner?)

graybeal commented 6 years ago

Examples from SWEET previously conveyed via slack:

@carueda @fgayanilo Some suggested specific questions to ask against the triple store: 1) What are all the individual units that SWEET knows? 2) What are the SWEET units that are the products of other units (my answer below; is there a way to do it without having to know reprSciUnits is the right file?)

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sweetunit: <http://sweetontology.net/reprSciUnits/>
SELECT ?sub  
WHERE { ?sub a sweetunit:UnitDefinedByProduct} 
ORDER BY ?sub

3) List all the SWEET ontology topics (by which the human means, the ontologies in SWEET, since each is a topic) 4) List all the classes in the SWEET xxx ontology (example: human, matrIon, ...) 5) What are all the physical states of matter in SWEET? (Now, this is tricky. For example http://cor.esipfed.org/ont?iri=http://sweetontology.net/statePhysical/Solid indicates "Solid" is a namedIndividual of type http://sweetontology.net/statePhysical/StateOfMatter, so can you ask for all namedIndividuals of that type? It appears you can, you don't have to say namedIndividuals if you know there aren't any other types of entity:

PREFIX sweetStatePhysical: <http://sweetontology.net/statePhysical/>
SELECT ?sub
WHERE { ?sub a sweetStatePhysical:StateOfMatter } 
ORDER BY ?sub
graybeal commented 6 years ago

Can SPARQL ask numerical and comparative questions, like 'find all ontologies with more than 50 properties', or find all ontologies with (no. of classes / no. of properties < 100) ?

How about 'find all ontologies with more than 10 classes that are not in the ontology namespace'?

These are more advanced, but useful for ontologies anyway. Not sure if they are useful examples.

carueda commented 6 years ago

Removed/replaced reference to the particular COR instance as this seems to apply to the ORR in general.

carueda commented 6 years ago

Also, it is not clear to me what specific changes are involved in this entry. If all of it is basically about how to do these things via SPARQL, perhaps all or most of this could be "resolved" via examples in documentation? Please indicate the specific intended effect.

graybeal commented 6 years ago

See also the examples at https://query.wikidata.org/ (at the Examples link).

graybeal commented 6 years ago

I opened this issue because of the specific request by Nonong for examples for the COR demonstration, and those examples were updated in time for that. So you could sign the ticket off as is.

Now this ticket serves as a useful reference going forward. I think a dedicated examples page (generic to any repository) in the main documentation would be a terrific outcome, it would be really helpful for understanding SPARQL better and how to query the ORR content.

lewismc commented 5 years ago

This has been addressed and is linked to from the SPARQL form.