* Query Examples on dbpedia.org/sparql/

** 1)
PREFIX : http://dbpedia.org/resource/
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX dbpedia-owl: http://dbpedia.org/ontology/

SELECT ?author_name ?title ?pages
FROM http://dbpedia.org/
WHERE {
?author rdf:type dbpedia-owl:Writer .
?author rdfs:label ?author_name
FILTER (LANG(?author_name)="en") .
?author dbpedia-owl:notableWork ?work .
?work dbpedia-owl:numberOfPages ?pages
FILTER (?pages > 500) .
?work rdfs:label ?title
FILTER (LANG(?title)="en").
}
LIMIT 100
RESULT:
author_name title pages
...
"Seth and Mary Eastman"@en <https://github.com/en> "Aunt Phillis's Cabin"@en
<https://github.com/en> "0"^^
http://www.w3.org/2001/XMLSchema#positiveInteger
...

** 2)
PREFIX : http://dbpedia.org/resource/
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX dbpedia-owl: http://dbpedia.org/ontology/

SELECT ?author_name ?title ?pages
FROM http://dbpedia.org/
WHERE {
?author rdf:type dbpedia-owl:Writer .
?author rdfs:label ?author_name
FILTER (LANG(?author_name)="en") .
?author dbpedia-owl:notableWork ?work .
?work dbpedia-owl:numberOfPages ?pages
FILTER (?pages > 500) .
?work rdfs:label ?title
FILTER (LANG(?title)="en").
}
ORDER BY (?pages)
LIMIT 100
RESULT:
"Seth and Mary Eastman"@en <https://github.com/en> "Aunt Phillis's Cabin"@en
<https://github.com/en> 140156966022648


* Summary and potential reason of this bug

There is no page for "Aunt Phillis's Cabin".
The numberOfPages is http://www.w3.org/2001/XMLSchema#positiveInteger.
When do the query, the triples will be
"Seth and Mary Eastman"@en <https://github.com/en> "Aunt Phillis's Cabin"@en
<https://github.com/en> "0"^^
http://www.w3.org/2001/XMLSchema#positiveInteger

However 0 is not positive integer.

The invalid result happens when ORDER BY used.
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to