-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Jim Balhoff edited this page Aug 20, 2013
·
33 revisions
owl-filter is a preprocessor for SPARQL queries. It parses embedded OWL class expressions and uses an OWL reasoner to replace them with FILTER
statements containing the URIs of subclasses of the given class expression (or superclasses, equivalent classes, or instances):
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ao: <http://purl.obolibrary.org/obo/my-anatomy-ontology/>
PREFIX of: <http://purl.org/phenoscape/owl-filter/syntax#>
SELECT DISTINCT ?gene
WHERE
{
?gene expressed_in ?structure .
?structure rdf:type ?structure_class .
# Triple pattern containing an OWL expression:
?structure_class rdfs:subClassOf "ao:muscle and (ao:part_of some ao:head)"^^of:omn
}
becomes:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ao: <http://purl.obolibrary.org/obo/my-anatomy-ontology/>
PREFIX of: <http://purl.org/phenoscape/owl-filter/syntax#>
SELECT DISTINCT ?gene
WHERE
{
?gene expressed_in ?structure .
?structure rdf:type ?structure_class .
# Filter constraining ?structure_class to the terms returned by the OWL query:
FILTER(?structure_class IN (ao:adductor_mandibulae, ao:constrictor_dorsalis, ...))
}
Some existing systems provide similar or related functionality:
- Terp syntax for Pellet
- SPARQL-DL (even more powerful in that DL expressions can contain variables)
- and probably others
However, unlike those systems, owl-filter can be used to combine any OWL API-based reasoner with any SPARQL endpoint. Also, owl-filter SPARQL queries do not introduce any non-standard syntax and can be built with existing libraries such as Jena.