This HTML5 document contains 48 embedded RDF statements represented using HTML+Microdata notation.

The embedded RDF content will be recognized by any processor of HTML5 Microdata.

PrefixNamespace IRI
n5http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1+%3B+%0D%0A+++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
dctermshttp://purl.org/dc/terms/
n24http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n31http://docs.openlinksw.com/virtuoso/rdfsparqlrule.html#
n6http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+%3Ft+%3B+%0D%0A+++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n13http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs1%3E%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n27http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fitem+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n16http://vos.openlinksw.com/dataspace/services/wiki/
oplhttp://www.openlinksw.com/schema/attribution#
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
n35http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1or2+%3B+%0D%0A++++++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n36http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+%3Ft+%3B+%0D%0A+++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
dchttp://purl.org/dc/elements/1.1/
n9http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs1%3E%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n14http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n17http://rdfs.org/sioc/services#
siocthttp://rdfs.org/sioc/types#
n11http://vos.openlinksw.com/dataspace/person/dav#
n32http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1or2+%3B+%0D%0A++++++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n34http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs2%3E+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n7http://vos.openlinksw.com/dataspace/owiki/wiki/
n25http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+bif%3Acoalesce%28%3Fstep_no%2C+0%29+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+OPTION+%28transitive%2C+t_direction+1%2C+t_step%28%22step_no%22%29+as+%3Fstep_no%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D+%0D%0AORDER+BY+ASC+%28%3Fstep_no%29%0D%0A&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n4http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fitem+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n30http://demo.openlinksw.com/
n15http://vos.openlinksw.com/dataspace/owiki#
n21http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtTipsAndTricksTransitivityInferenceLists/sioc.
xsdhhttp://www.w3.org/2001/XMLSchema#
n33http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1+%3B+%0D%0A+++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n28http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n10http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs2%3E+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
n19http://vos.openlinksw.com/dataspace/person/owiki#
n29http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+bif%3Acoalesce%28%3Fstep_no%2C+0%29+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+OPTION+%28transitive%2C+t_direction+1%2C+t_step%28%22step_no%22%29+as+%3Fstep_no%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D+%0D%0AORDER+BY+ASC+%28%3Fstep_no%29%0D%0A&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=
siochttp://rdfs.org/sioc/ns#
Subject Item
n11:this
foaf:made
n2:VirtTipsAndTricksTransitivityInferenceLists
Subject Item
n14:this
sioc:creator_of
n2:VirtTipsAndTricksTransitivityInferenceLists
Subject Item
n16:item
n17:services_of
n2:VirtTipsAndTricksTransitivityInferenceLists
Subject Item
n15:this
sioc:creator_of
n2:VirtTipsAndTricksTransitivityInferenceLists
Subject Item
n7:VOS
sioc:container_of
n2:VirtTipsAndTricksTransitivityInferenceLists
atom:entry
n2:VirtTipsAndTricksTransitivityInferenceLists
atom:contains
n2:VirtTipsAndTricksTransitivityInferenceLists
Subject Item
n2:VirtTipsAndTricksTransitivityInferenceLists
rdf:type
atom:Entry sioct:Comment
dcterms:created
2017-06-13T05:41:53.241480
dcterms:modified
2017-06-29T07:41:47.375400
rdfs:label
VirtTipsAndTricksTransitivityInferenceLists
foaf:maker
n19:this n11:this
dc:title
VirtTipsAndTricksTransitivityInferenceLists
opl:isDescribedUsing
n21:rdf
sioc:has_creator
n14:this n15:this
sioc:content
%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---+How Do I use Transitivity via Inference Rules and Transitivity for lists? Two methods can be used for typical recursions, transitivity on inference and plain transitive patterns (or subqueries). The advantage of inference is that queries are short and one inference rule set may be maintained for numerous queries. If queries are about trees of classes or properties, or about equivalences of nodes, consider using inference rule sets. Transitive patterns are inconvenient and may easily result in queries that runs too long or hard to debug, but they're unavoidable in traversing social networks or plain querying of RDF lists. So consider a rule set, a handful of nodes with classes from the rule set and a couple of RDF Lisp-style lists defined on demo.openlinksw.com: <verbatim> SQL> SPARQL CLEAR GRAPH <http://example.com/2/owl>; callret-0 VARCHAR _______________________________________________________________________________ Clear <http://example.com/2/owl> -- done 1 Rows. -- 0 msec. SQL> TTLP (' @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#> . @prefix e: <http://example.com/e/> . e:c1 rdfs:subClassOf e:c1or2 . e:c2 rdfs:subClassOf e:c1or2 . e:c1-10 rdfs:subClassOf e:c1 . e:c1-20 rdfs:subClassOf e:c1 . e:c2-30 rdfs:subClassOf e:c2 . e:c2-40 rdfs:subClassOf e:c2 . ', 'http://example.com/2/owl', 'http://example.com/2/owl' ); Done. -- 0 msec. </verbatim> You can also use the SPARUL equivalent variant: <verbatim> SPARQL 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#> PREFIX e: <http://example.com/e/> INSERT IN GRAPH <http://example.com/2/owl> { e:c1 rdfs:subClassOf e:c1or2 . e:c2 rdfs:subClassOf e:c1or2 . e:c1-10 rdfs:subClassOf e:c1 . e:c1-20 rdfs:subClassOf e:c1 . e:c2-30 rdfs:subClassOf e:c2 . e:c2-40 rdfs:subClassOf e:c2 . } ; </verbatim> Define the inference rule: <verbatim> SQL> rdfs_rule_set ('http://example.com/2/owl', 'http://example.com/2/owl'); Done. -- 0 msec. SQL> SPARQL CLEAR GRAPH <http://example.com/2/data> ; callret-0 VARCHAR _______________________________________________________________________________ Clear <http://example.com/2/data> -- done 1 Rows. -- 0 msec. SQL> TTLP (' @prefix e: <http://example.com/e/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . e:s1 a e:c1 ; e:p1 "Value of p1 for s1" . e:s2 a e:c2 ; e:p1 "Value of p1 for s2" . e:s1-10 a e:c1-10 ; e:p1 "Value of p1 for s1-10" . e:s1-20 a e:c1-20 ; e:p1 "Value of p1 for s1-20" . e:s2-30 a e:c2-30 ; e:p1 "Value of p1 for s2-30" . e:s2-40 a e:c2-40 ; e:p1 "Value of p1 for s2-40" . e:lists rdf:_1 ( e:list1-item1 e:list1-item2 e:list1-item3 ) ; rdf:_2 ( [ e:p2 "Value of p2 of item1 of list2" ; e:p3 "Value of p3 of item1 of list2" ] [ e:p2 "Value of p2 of item2 of list2" ; e:p3 "Value of p3 of item2 of list2" ] [ e:p2 "Value of p2 of item3 of list2" ; e:p3 "Value of p3 of item3 of list2" ] ) . ', 'http://example.com/2/data', 'http://example.com/2/data' ); Done. -- 0 msec. </verbatim> You can also use the SPARUL equivalent variant: <verbatim> SPARQL PREFIX e: <http://example.com/e/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> INSERT IN GRAPH <http://example.com/2/data> { e:s1 a e:c1 ; e:p1 "Value of p1 for s1" . e:s2 a e:c2 ; e:p1 "Value of p1 for s2" . e:s1-10 a e:c1-10 ; e:p1 "Value of p1 for s1-10" . e:s1-20 a e:c1-20 ; e:p1 "Value of p1 for s1-20" . e:s2-30 a e:c2-30 ; e:p1 "Value of p1 for s2-30" . e:s2-40 a e:c2-40 ; e:p1 "Value of p1 for s2-40" . e:lists rdf:_1 ( e:list1-item1 e:list1-item2 e:list1-item3 ) ; rdf:_2 ( [ e:p2 "Value of p2 of item1 of list2" ; e:p3 "Value of p3 of item1 of list2" ] [ e:p2 "Value of p2 of item2 of list2" ; e:p3 "Value of p3 of item2 of list2" ] [ e:p2 "Value of p2 of item3 of list2" ; e:p3 "Value of p3 of item3 of list2" ] ) }; </verbatim> SPARQL DESCRIBE works fine with inference, deriving additional type information: <verbatim> DEFINE input:inference <http://example.com/2/owl> DESCRIBE <http://example.com/e/s1> FROM <http://example.com/2/data> fmtaggret- LONG VARCHAR _______________________________________________________________________________ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ns1: <http://example.com/e/> . ns1:s1 rdf:type ns1:c1or2 , ns1:c1 ; ns1:p1 "Value of p1 for s1" . 1 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs1%3E%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs1%3E%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] <verbatim> DEFINE input:inference <http://example.com/2/owl> DESCRIBE <http://example.com/e/s2> FROM <http://example.com/2/data> fmtaggret- LONG VARCHAR _______________________________________________________________________________ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ns1: <http://example.com/e/> . ns1:s2 rdf:type ns1:c1or2 , ns1:c2 ; ns1:p1 "Value of p1 for s2" . 1 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs2%3E+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E%0D%0ADESCRIBE+%3Chttp%3A%2F%2Fexample.com%2Fe%2Fs2%3E+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E&should-sponge=&format=application%2Frdf%2Bxml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] Querying is simple as well: <verbatim> SQL>SPARQL DEFINE input:inference <http://example.com/2/owl> PREFIX e:<http://example.com/e/> SELECT * FROM <http://example.com/2/data> WHERE { ?s a e:c1or2 ; e:p1 ?o } s o VARCHAR VARCHAR ___________________________ http://example.com/e/s1 Value of p1 for s1 http://example.com/e/s1-10 Value of p1 for s1-10 http://example.com/e/s1-20 Value of p1 for s1-20 http://example.com/e/s2-30 Value of p1 for s2-30 http://example.com/e/s2-40 Value of p1 for s2-40 http://example.com/e/s2 Value of p1 for s2 6 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1or2+%3B+%0D%0A++++++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E+%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1or2+%3B+%0D%0A++++++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] <verbatim> SQL>SPARQL DEFINE input:inference <http://example.com/2/owl> PREFIX e:<http://example.com/e/> SELECT * FROM <http://example.com/2/data> WHERE { ?s a e:c1 ; e:p1 ?o } s o VARCHAR VARCHAR ___________________________ http://example.com/e/s1 Value of p1 for s1 http://example.com/e/s1-10 Value of p1 for s1-10 http://example.com/e/s1-20 Value of p1 for s1-20 3 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1+%3B+%0D%0A+++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+e%3Ac1+%3B+%0D%0A+++++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] However you should care about duplicates if both types and properties are queried: the join will result in all combinations of types and property values. <verbatim> SQL>SPARQL DEFINE input:inference <http://example.com/2/owl> PREFIX e:<http://example.com/e/> SELECT * FROM <http://example.com/2/data> WHERE { ?s a ?t ; e:p1 ?o } s t o VARCHAR VARCHAR VARCHAR ___________________________ http://example.com/e/s1 http://example.com/e/c1 Value of p1 for s1 http://example.com/e/s1 http://example.com/e/c1or2 Value of p1 for s1 http://example.com/e/s1-10 http://example.com/e/c1-10 Value of p1 for s1-10 http://example.com/e/s1-10 http://example.com/e/c1 Value of p1 for s1-10 http://example.com/e/s1-10 http://example.com/e/c1or2 Value of p1 for s1-10 http://example.com/e/s1-20 http://example.com/e/c1-20 Value of p1 for s1-20 http://example.com/e/s1-20 http://example.com/e/c1 Value of p1 for s1-20 http://example.com/e/s1-20 http://example.com/e/c1or2 Value of p1 for s1-20 http://example.com/e/s2-30 http://example.com/e/c2-30 Value of p1 for s2-30 http://example.com/e/s2-30 http://example.com/e/c2 Value of p1 for s2-30 http://example.com/e/s2-30 http://example.com/e/c1or2 Value of p1 for s2-30 http://example.com/e/s2-40 http://example.com/e/c2-40 Value of p1 for s2-40 http://example.com/e/s2-40 http://example.com/e/c2 Value of p1 for s2-40 http://example.com/e/s2-40 http://example.com/e/c1or2 Value of p1 for s2-40 http://example.com/e/s2 http://example.com/e/c2 Value of p1 for s2 http://example.com/e/s2 http://example.com/e/c1or2 Value of p1 for s2 16 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+%3Ft+%3B+%0D%0A+++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=DEFINE+input%3Ainference+%3Chttp%3A%2F%2Fexample.com%2F2%2Fowl%3E++%0D%0APREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+*+FROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B+%0D%0A++++%3Fs+a+%3Ft+%3B+%0D%0A+++++e%3Ap1+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] Transitive queries are convenient as SPARQL 1.1 "predicate+" equivalent. The equivalent of "predicate*" requires the use of a union: <verbatim> SQL>SPARQL PREFIX e:<http://example.com/e/> SELECT ?item FROM <http://example.com/2/data> WHERE { { ?lists rdf:_1 ?node } UNION { ?lists rdf:_1 ?l . ?l rdf:rest ?node option (transitive) . } ?node rdf:first ?item } item VARCHAR _______________________________________________________________________________ http://example.com/e/list1-item1 http://example.com/e/list1-item2 http://example.com/e/list1-item3 3 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fitem+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fitem+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_1+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] <verbatim> SQL> SPARQL PREFIX e:<http://example.com/e/> SELECT ?p ?o FROM <http://example.com/2/data> WHERE { { ?lists rdf:_2 ?node } UNION { ?lists rdf:_2 ?l . ?l rdf:rest ?node option (transitive) . } ?node rdf:first ?item . ?item ?p ?o } p o VARCHAR VARCHAR ________________________ http://example.com/e/p2 Value of p2 of item1 of list2 http://example.com/e/p3 Value of p3 of item1 of list2 http://example.com/e/p2 Value of p2 of item2 of list2 http://example.com/e/p3 Value of p3 of item2 of list2 http://example.com/e/p2 Value of p2 of item3 of list2 http://example.com/e/p3 Value of p3 of item3 of list2 6 Rows. -- 0 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+option+%28transitive%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] Note that the result set can be in order of items in the list, but it don't have to. If the order should be preserved, then fix the direction of transitive scan, get step number as a variable, order by that variable. <verbatim> SQL> SPARQL PREFIX e:<http://example.com/e/> SELECT ?p ?o bif:coalesce(?step_no, 0) FROM <http://example.com/2/data> WHERE { { ?lists rdf:_2 ?node } UNION { ?lists rdf:_2 ?l . ?l rdf:rest ?node OPTION (transitive, t_direction 1, t_step("step_no") as ?step_no) . } ?node rdf:first ?item . ?item ?p ?o } ORDER BY ASC (?step_no) p o callret-2 VARCHAR VARCHAR VARCHAR ________________________ http://example.com/e/p2 Value of p2 of item1 of list2 0 http://example.com/e/p3 Value of p3 of item1 of list2 0 http://example.com/e/p2 Value of p2 of item2 of list2 1 http://example.com/e/p3 Value of p3 of item2 of list2 1 http://example.com/e/p2 Value of p2 of item3 of list2 2 http://example.com/e/p3 Value of p3 of item3 of list2 2 6 Rows. -- 7 msec. </verbatim> Example links against [[http://demo.openlinksw.com/sparql][Virtuoso Demo Server SPARQL Endpoint]] with SPARQl Protocol URLs: * [[http://demo.openlinksw.com/sparql?default-graph-uri=&query=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+bif%3Acoalesce%28%3Fstep_no%2C+0%29+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+OPTION+%28transitive%2C+t_direction+1%2C+t_step%28%22step_no%22%29+as+%3Fstep_no%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D+%0D%0AORDER+BY+ASC+%28%3Fstep_no%29%0D%0A&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View results page]] * [[http://demo.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX+e%3A%3Chttp%3A%2F%2Fexample.com%2Fe%2F%3E%0D%0ASELECT+%3Fp+%3Fo+bif%3Acoalesce%28%3Fstep_no%2C+0%29+%0D%0AFROM+%3Chttp%3A%2F%2Fexample.com%2F2%2Fdata%3E++%0D%0AWHERE+%0D%0A++%7B%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fnode+%0D%0A++++%7D%0D%0A++++UNION%0D%0A++++%7B+%0D%0A++++++%3Flists+rdf%3A_2+%3Fl+.%0D%0A++++++%3Fl+rdf%3Arest+%3Fnode+OPTION+%28transitive%2C+t_direction+1%2C+t_step%28%22step_no%22%29+as+%3Fstep_no%29+.+%0D%0A++++%7D%0D%0A++++%3Fnode+rdf%3Afirst+%3Fitem+.%0D%0A++++%3Fitem+%3Fp+%3Fo+%0D%0A++%7D+%0D%0AORDER+BY+ASC+%28%3Fstep_no%29%0D%0A&should-sponge=&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=0&debug=on][View editor page]] ---++Related * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]] * [[http://docs.openlinksw.com/virtuoso/rdfsparqlrule.html#rdfsparqlrulesubclassandsubprop][Virtuoso Documentation: Subclasses and Subproperties]] * [[VirtsubClassOfOrientedSubsumptionTransitiveOptions][Transitive SPARQL query options and Exploit Inference Rules Examples]]
sioc:id
d44486517f677929940cf4a0fba234b7
sioc:link
n2:VirtTipsAndTricksTransitivityInferenceLists
sioc:has_container
n7:VOS
n17:has_services
n16:item
atom:title
VirtTipsAndTricksTransitivityInferenceLists
sioc:links_to
n4:on n5:on n6:on n9:on n10:on n13:on n24:on n25:on n27:on n28:on n29:on n30:sparql n31:rdfsparqlrulesubclassandsubprop n32:on n33:on n34:on n35:on n36:on
atom:source
n7:VOS
atom:author
n11:this
atom:published
2017-06-13T05:41:53Z
atom:updated
2017-06-29T07:41:47Z
sioc:topic
n7:VOS
Subject Item
n2:VirtsubClassOfOrientedSubsumptionTransitiveOptions
sioc:links_to
n2:VirtTipsAndTricksTransitivityInferenceLists