This HTML5 document contains 36 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/
atomhttp://atomowl.org/ontologies/atomrdf#
foafhttp://xmlns.com/foaf/0.1/
n12http://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/
n7http://uriburner.com/c/
n13http://vos.openlinksw.com/dataspace/dav#
rdfshttp://www.w3.org/2000/01/rdf-schema#
n11http://rdfs.org/sioc/services#
siocthttp://rdfs.org/sioc/types#
n10http://vos.openlinksw.com/dataspace/person/dav#
n4http://vos.openlinksw.com/dataspace/owiki/wiki/
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
n9http://vos.openlinksw.com/dataspace/owiki#
xsdhhttp://www.w3.org/2001/XMLSchema#
n17http://vos.openlinksw.com/dataspace/owiki/wiki/VOS/VirtTipsAndTricksSPARQLArithmeticCollection/sioc.
n18http://vos.openlinksw.com/dataspace/person/owiki#
siochttp://rdfs.org/sioc/ns#
Subject Item
n10:this
foaf:made
n2:VirtTipsAndTricksSPARQLArithmeticCollection
Subject Item
n13:this
sioc:creator_of
n2:VirtTipsAndTricksSPARQLArithmeticCollection
Subject Item
n12:item
n11:services_of
n2:VirtTipsAndTricksSPARQLArithmeticCollection
Subject Item
n9:this
sioc:creator_of
n2:VirtTipsAndTricksSPARQLArithmeticCollection
Subject Item
n4:VOS
sioc:container_of
n2:VirtTipsAndTricksSPARQLArithmeticCollection
atom:entry
n2:VirtTipsAndTricksSPARQLArithmeticCollection
atom:contains
n2:VirtTipsAndTricksSPARQLArithmeticCollection
Subject Item
n2:VirtTipsAndTricksSPARQLArithmeticCollection
rdf:type
sioct:Comment atom:Entry
dcterms:created
2017-06-13T05:45:09.539662
dcterms:modified
2017-06-29T07:41:44.167293
rdfs:label
VirtTipsAndTricksSPARQLArithmeticCollection
foaf:maker
n18:this n10:this
dc:title
VirtTipsAndTricksSPARQLArithmeticCollection
opl:isDescribedUsing
n17:rdf
sioc:has_creator
n9:this n13:this
sioc:content
%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---+SPARQL Date Arithmetic Examples Collection The following collection presents examples of SPARQL Date arithmetic calculations. %TOC% ---++Sample listing of musicians that includes age at time of death <verbatim> SELECT ?s ?genre ?died ?born ( bif:datediff( 'year', xsd:dateTime( str(?born) ), xsd:dateTime( str(?died) ) ) ) AS ?age WHERE { { SELECT DISTINCT ?s ?genre ?died ?born FROM <http://dbpedia.org> WHERE { ?s a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; <http://dbpedia.org/ontology/birthDate> ?born . } LIMIT 20 } } </verbatim> View [[http://uriburner.com/c/IHWYXN][online]] the results of executing this query. ---++Sample listing of musicians (includes use of IF for data cleansing) that includes age at time of death <verbatim> SELECT ?person ?genre ?died ?born ( IF ( ( datatype (?born) in (xsd:dateTime, xsd:date) ) and ( datatype (?died) in (xsd:dateTime, xsd:date) ), bif:datediff( 'year', xsd:dateTime( str(?born) ), xsd:dateTime( str(?died) ) ), "error" ) ) AS ?age WHERE { { SELECT DISTINCT ?person ?genre ?died ?born FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; <http://dbpedia.org/ontology/birthDate> ?born . } ORDER BY DESC ( <LONG::IRI_RANK> (?person) ) LIMIT 100 } } </verbatim> View [[http://uriburner.com/c/IHZRVY][online]] the results of executing this query. ---++Sample listing of musicians that includes birth date, death date, and age ordered by musicians entity rank <verbatim> SELECT DISTINCT ?person ?plabel ?genre ?glabel ?died ?born ( <LONG::IRI_RANK> (?person) ) as ?rank ( IF ( ( datatype (?born) in (xsd:dateTime, xsd:date) ) and ( datatype (?died) in (xsd:dateTime, xsd:date) ), bif:datediff( 'year', xsd:dateTime( str(?born) ), xsd:dateTime( str(?died) ) ), "error" ) ) AS ?age WHERE { { SELECT DISTINCT ?person ?plabel ?genre ?glabel ?died ?born FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; rdfs:label ?plabel ; <http://dbpedia.org/ontology/birthDate> ?born . ?genre rdfs:label ?glabel . FILTER (lang(?plabel) = "en") FILTER (lang(?glabel) = "en") } ORDER BY DESC ( <LONG::IRI_RANK> (?person) ) LIMIT 100 } } </verbatim> View [[http://uriburner.com/c/IGGP5I][online]] the results of executing this query. ---++Sample listing of musicians that includes average age at time of death, by genre <verbatim> SELECT ?genre, (avg(?age)) AS ?avg WHERE { { SELECT DISTINCT ?genre ?person (bif:datediff( 'year', xsd:dateTime( str(?born) ), xsd:dateTime( str(?died)))) as ?age WHERE { { SELECT DISTINCT ?person ?genre ?died ?born FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; <http://dbpedia.org/ontology/birthDate> ?born . FILTER ( datatype (?born) IN (xsd:dateTime, xsd:date) ) FILTER ( datatype (?died) IN (xsd:dateTime, xsd:date) ) } } } } } GROUP BY (?genre) ORDER BY DESC (?avg) LIMIT 100 </verbatim> View [[http://uriburner.com/c/IGGP5B][online]] the results of executing this query. ---++ Sample listing of musicians that includes average age at time of death with entity rank, by genre <verbatim> SELECT ?genre, (avg(?age)) AS ?avg, ( <LONG::IRI_RANK> (?person) ) as ?rank WHERE { { SELECT DISTINCT ?genre ?person ( bif:datediff ( 'year', xsd:dateTime( str(?born) ), xsd:dateTime( str(?died) ) ) ) as ?age WHERE { { SELECT DISTINCT ?person ?genre ?died ?born FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; <http://dbpedia.org/ontology/birthDate> ?born . FILTER ( datatype (?born) IN (xsd:dateTime, xsd:date) ) FILTER ( datatype (?died) IN (xsd:dateTime, xsd:date) ) } } } ORDER BY DESC ( <LONG::IRI_RANK> (?person) ) } } ORDER BY DESC (?avg) LIMIT 100 </verbatim> View [[http://uriburner.com/c/IHWYXK][online]] the results of executing this query. ---++ Sample listing of musicians that includes average age at time of death with entity rank, by genre and Pretty Labels <verbatim> SELECT ?genre, str(?glabel) as ?genre_names, (avg(?age)) AS ?avg, ( <LONG::IRI_RANK> (?person) ) as ?rank WHERE { { SELECT DISTINCT ?genre ?person ?glabel ( IF ( ( datatype (?born) in (xsd:dateTime, xsd:date) ) and ( datatype (?died) in (xsd:dateTime, xsd:date) ), bif:datediff('year',xsd:dateTime(str(?born)),xsd:dateTime(str(?died))), "error" ) ) as ?age WHERE { { SELECT DISTINCT ?person ?genre ?died ?born ?glabel FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; <http://dbpedia.org/ontology/birthDate> ?born . FILTER ( datatype (?born) IN (xsd:dateTime, xsd:date) ) FILTER ( datatype (?died) IN (xsd:dateTime, xsd:date) ) ?genre rdfs:label ?glabel . FILTER (?born < ?died) . FILTER ( lang(?glabel) = "en" ) } } } ORDER BY DESC ( <LONG::IRI_RANK> (?person) ) } } ORDER BY DESC (?avg) LIMIT 100 </verbatim> View [[http://uriburner.com/c/86SSZ][online]] the results of executing this query. ---++ Sample listing of musicians that includes Entity Rank, Grouping and Pretty Labels <verbatim> SELECT DISTINCT ?person str(?plabel) ?genre str(?glabel) ?died ?born ( <LONG::IRI_RANK> (?person) ) as ?rank ( IF ( ( datatype (?born) in (xsd:dateTime, xsd:date) ) and ( datatype (?died) in (xsd:dateTime, xsd:date) ), bif:datediff('year',xsd:dateTime(str(?born)),xsd:dateTime(str(?died))), "error" ) ) AS ?age WHERE { { SELECT DISTINCT ?person ?plabel ?genre ?glabel ?died ?born FROM <http://dbpedia.org> WHERE { ?person a <http://dbpedia.org/ontology/MusicalArtist> ; <http://dbpedia.org/ontology/genre> ?genre ; <http://dbpedia.org/ontology/deathDate> ?died ; rdfs:label ?plabel ; <http://dbpedia.org/ontology/birthDate> ?born . ?genre rdfs:label ?glabel . FILTER ( lang(?plabel) = "en" ) FILTER ( lang(?glabel) = "en" ) } ORDER BY DESC ( <LONG::IRI_RANK> (?person) ) LIMIT 100 } } </verbatim> View [[http://uriburner.com/c/IGGP4Z][online]] the results of executing this query. ---++Related * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]
sioc:id
441e2a858279cecf7caaa91f8cc5bcbb
sioc:link
n2:VirtTipsAndTricksSPARQLArithmeticCollection
sioc:has_container
n4:VOS
n11:has_services
n12:item
atom:title
VirtTipsAndTricksSPARQLArithmeticCollection
sioc:links_to
n7:IGGP5B n7:IHWYXK n7:IHZRVY n7:IGGP5I n7:86SSZ n7:IGGP4Z n7:IHWYXN
atom:source
n4:VOS
atom:author
n10:this
atom:published
2017-06-13T05:45:09Z
atom:updated
2017-06-29T07:41:44Z
sioc:topic
n4:VOS