virtuoso - Property Path equivalent to OPTION(TRANSITIVE) statement in SPARQL -
i'm naive user trying replicate query results in following type of string:
derives_from (epithelial cell , (part_of (uterine cervix , (part_of (homo sapiens , (has disease adenocarcinoma)))))
i'm @ hackathon, have no ontology/sparql expert, , we're trying these related fields out of ontology , solr. we're desperate!
the webpage http://www.ontobee.org/ontology/clo?iri=http://purl.obolibrary.org/obo/clo_000368) helpfully provides sparql queries used on page. think relevant query:
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> select distinct ?ref ?refp ?label ?o <http://purl.obolibrary.org/obo/merged/clo> { ?ref ?refp ?o . filter ( ?refp in ( owl:equivalentclass, rdfs:subclassof ) ) . optional { ?ref rdfs:label ?label } . { { select ?s ?o <http://purl.obolibrary.org/obo/merged/clo> { ?o ?p ?s . filter ( ?p in ( rdf:first, rdf:rest, owl:intersectionof, owl:unionof, owl:somevaluesfrom, owl:hasvalue, owl:allvaluesfrom, owl:complementof, owl:inverseof, owl:onclass, owl:onproperty ) ) } } option ( transitive, t_in( ?s ), t_out( ?o ), t_step( ?s ) ?link ). filter ( ?s= <http://purl.obolibrary.org/obo/clo_0003684> ) } } order ?label however, can't run check, because sparql endpoint doesn't support virtuoso. http://sparql.bioontology.org so, spits error on option(transitive). can show me equivalent standard pathway language? there varying pathway lengths between target nodes.
virtuoso's transitivity operator more powerful standard sparql provides, in general case not possible express same thing in single standard sparql query. however, believe in case is possible.
the following property path equivalent (disclaimer, haven't tested query, should give general idea):
?o (rdf:first|rdf:rest|owl:intersectionof|owl:unionof|owl:somevaluesfrom|owl:hasvalue|owl:allvaluesfrom|owl:complementof|owl:inverseof|owl:onclass|owl:onproperty)+ ?s . the full query become this:
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> select distinct ?ref ?refp ?label ?o <http://purl.obolibrary.org/obo/merged/clo> { ?ref ?refp ?o . filter ( ?refp in ( owl:equivalentclass, rdfs:subclassof ) ) . optional { ?ref rdfs:label ?label } . { { select ?s ?o <http://purl.obolibrary.org/obo/merged/clo> { ?o (rdf:first|rdf:rest|owl:intersectionof|owl:unionof|owl:somevaluesfrom|owl:hasvalue|owl:allvaluesfrom|owl:complementof|owl:inverseof|owl:onclass|owl:onproperty)+ ?s . } } filter ( ?s= <http://purl.obolibrary.org/obo/clo_0003684> ) } } order ?label note, way, filter condition on variable ?s outside subselect, might make query bit of performance hog. since not using ?s anywhere else in query, can simplify part of query further, eliminating filter, so:
{ { select ?o <http://purl.obolibrary.org/obo/merged/clo> { ?o (rdf:first|rdf:rest|owl:intersectionof|owl:unionof|owl:somevaluesfrom|owl:hasvalue|owl:allvaluesfrom|owl:complementof|owl:inverseof|owl:onclass|owl:onproperty)+ <http://purl.obolibrary.org/obo/clo_0003684> . } } }
Comments
Post a Comment