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

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

PrefixNamespace IRI
dctermshttp://purl.org/dc/terms/
n19http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtSPARQLOptGuideEx2/sioc.
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n10http://vos.openlinksw.com/dataspace/services/wiki/
oplhttp://www.openlinksw.com/schema/attribution#
n2http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/
dchttp://purl.org/dc/elements/1.1/
n6http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n11http://rdfs.org/sioc/services#
siocthttp://rdfs.org/sioc/types#
n4http://vos.openlinksw.com/dataspace/person/dav#
n8http://vos.openlinksw.com/dataspace/owiki/wiki/
n21http://docs.openlinksw.com/virtuoso/sequenceobjects.
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n7http://vos.openlinksw.com/dataspace/owiki#
xsdhhttp://www.w3.org/2001/XMLSchema#
n13http://docs.openlinksw.com/virtuoso/fn_sequence_next.
n12http://vos.openlinksw.com/dataspace/%28NULL%29/wiki/VOS/
n20http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
Subject Item
n4:this
foaf:made
n2:VirtSPARQLOptGuideEx2
Subject Item
n6:this
sioc:creator_of
n2:VirtSPARQLOptGuideEx2
Subject Item
n10:item
n11:services_of
n2:VirtSPARQLOptGuideEx2
Subject Item
n7:this
sioc:creator_of
n2:VirtSPARQLOptGuideEx2
Subject Item
n8:VOS
sioc:container_of
n2:VirtSPARQLOptGuideEx2
atom:entry
n2:VirtSPARQLOptGuideEx2
atom:contains
n2:VirtSPARQLOptGuideEx2
Subject Item
n2:VirtSPARQLOptGuideEx2
rdf:type
sioct:Comment atom:Entry
dcterms:created
2017-06-13T05:35:59.109053
dcterms:modified
2017-06-13T05:35:59.109053
rdfs:label
VirtSPARQLOptGuideEx2
foaf:maker
n4:this n20:this
dc:title
VirtSPARQLOptGuideEx2
opl:isDescribedUsing
n19:rdf
sioc:has_creator
n6:this n7:this
sioc:content
%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---+ Generating a Unique ID via SPARQL HTTP Suppose you need unique IDs from within Virtuoso (unique only to a given Virtuoso instance/cluster would suffice), and that this should be done via SPARQL HTTP prior to issuing a SPARQL insert. One solution would be to create a table and procedure that keeps track of an incremental ID and returns each ID only once. Then you can access this procedure via SPARQL HTTP by using: <verbatim> ( SELECT ( bif:foo() ) AS ?id WHERE { ?s ?p ?o } limit 1 ) </verbatim> ---++ An optimized solution Virtuoso's built-in functions (BIFs) <code>[[http://docs.openlinksw.com/virtuoso/fn_sequence_next.html][sequence_next()]]</code> and <code>[[http://docs.openlinksw.com/virtuoso/sequenceobjects.html][sequence_set()]]</code> will streamline this task. Like any other SQL functions without INOUT or OUT parameters, these can be called from SPARQL simply as <b><code>bif:sequence_next()</code></b> or <b><code>bif:sequence_set()</code></b>, but an IN parameter may be used to get one sequence per graph, i.e., <b><code><nowiki>bif:sequence_next("GRAPH_IDENTIFIER")</nowiki></code></b>, e.g., <code><nowiki>bif:sequence_next("&lt;http://my.example.com/graph1&gt;")</nowiki></code>. <verbatim> SQL> SPARQL INSERT INTO GRAPH <http://mygraph.com> { <:a> <:p> `bif:sequence_next("<http://mygraph.com>")` } ; callret-0 VARCHAR _______________________________________________________________________________ Insert into <http://mygraph.com>, 1 (or less) triples -- done 1 Rows. -- 141 msec. SQL> SPARQL INSERT INTO GRAPH <http://mygraph.com> { <:a> <:p> `bif:sequence_next("<http://mygraph.com>")` } ; callret-0 VARCHAR _______________________________________________________________________________ Insert into <http://mygraph.com>, 1 (or less) triples -- done 1 Rows. -- 4 msec. SQL> SPARQL SELECT * FROM <http://mygraph.com> WHERE { ?s ?p ?o } ; s p o VARCHAR VARCHAR VARCHAR _______________________________________________________________________________ :a :p 0 :a :p 1 2 Rows. -- 1 msec. SQL> </verbatim> ---++ Side-note -- bif: prefix vs. sql: prefix For user-defined functions, the <b><code>sql:</code></b> prefix is preferred over the <b><code>bif:</code></b> prefix; e.g., <verbatim> sql:foo(x) </verbatim> -- will call -- <verbatim> DB.DBA.foo(x) </verbatim> The difference is that <code>bif:foo</code> will make an unqualified call to <code>foo()</code>. If no built-in function <code>foo()</code> exists, and the system contains many users and database qualifiers, the search for exact name of <code>XXX.YYY.foo()</code> adds needless overhead. Further issues may arise if multiple <code>XXX.YYY.foo()</code> procedures have been defined. ---++ Related * [[VirtSPARQLOptGuide][Virtuoso SPARQL Optimization Guide]]
sioc:id
e9171d8c23180404b2318808dc2066bf
sioc:link
n2:VirtSPARQLOptGuideEx2
sioc:has_container
n8:VOS
n11:has_services
n10:item
atom:title
VirtSPARQLOptGuideEx2
sioc:links_to
n12:VirtSPARQLOptGuide n13:html n21:html
atom:source
n8:VOS
atom:author
n4:this
atom:published
2017-06-13T05:35:59Z
atom:updated
2017-06-13T05:35:59Z
sioc:topic
n8:VOS
Subject Item
n2:VirtSPARQLOptGuide
sioc:links_to
n2:VirtSPARQLOptGuideEx2