SPARQL: one query works; a similar query fails -
have 2 sparql queries use w3c pyrdfa extractor.
1: query produces expected results:
prefix dc: <http://purl.org/dc/elements/1.1/> prefix foaf: <http://xmlns.com/foaf/0.1/> select ?content ?author <http://www.w3.org/2007/08/pyrdfa/extract?uri=http://www.3kbo.com/examples/rdfa/simple.html> { ?s dc:creator ?o . ?s dc:title ?content . ?o foaf:name ?author . } order ?content
here result:
http://www.sparql.org/sparql?query=prefix+dc%3a+%3chttp%3a%2f%2fpurl.org%2fdc%2felements%2f1.1%2f%3e%0d%0aprefix+foaf%3a+%3chttp%3a%2f%2fxmlns.com%2ffoaf%2f0.1%2f%3e%0d%0aselect+%3fcontent+%3fauthor%0d%0afrom+%3chttp%3a%2f%2fwww.w3.org%2f2007%2f08%2fpyrdfa%2fextract%3furi%3dhttp%3a%2f%2fwww.3kbo.com%2fexamples%2frdfa%2fsimple.html%3e%0d%0awhere+{%0d%0a%09%3fs+dc%3acreator+%3fo+.%0d%0a%09%3fs+dc%3atitle+%3fcontent+.%0d%0a%09%3fo+foaf%3aname+%3fauthor+.%0d%0a%09}%0d%0aorder+by+%3fcontent&default-graph-uri=&output=text&stylesheet=%2fxml-to-html.xsl
2: query not produce result similar above:
prefix dc: <http://purl.org/dc/elements/1.1/> prefix foaf: <http://xmlns.com/foaf/0.1/> select ?content ?author <http://www.w3.org/2007/08/pyrdfa/extract?uri=http://www.w3.org/2013/talks/0902-lisbon-ih/> { ?s dc:author ?o . ?s dc:title ?content . ?o foaf:name ?author . } order ?content
here result:
http://www.sparql.org/sparql?query=prefix+dc%3a+%3chttp%3a%2f%2fpurl.org%2fdc%2felements%2f1.1%2f%3e%0d%0aprefix+foaf%3a+%3chttp%3a%2f%2fxmlns.com%2ffoaf%2f0.1%2f%3e%0d%0aselect+%3fcontent+%3fauthor%0d%0afrom+%3chttp%3a%2f%2fwww.w3.org%2f2007%2f08%2fpyrdfa%2fextract%3furi%3dhttp%3a%2f%2fwww.w3.org%2f2013%2ftalks%2f0902-lisbon-ih%2f%3e%0d%0awhere+{%0d%0a%09%3fs+dc%3aauthor+%3fo+.%0d%0a%09%3fs+dc%3atitle+%3fcontent+.%0d%0a%09%3fo+foaf%3aname+%3fauthor+.%0d%0a%09}%0d%0aorder+by+%3fcontent%0d%0a&default-graph-uri=&output=text&stylesheet=%2fxml-to-html.xsl
why #2 fail produce result #1?
is there error in sparql code #2?
or there semantic difference in structure of rdfa associated #1 , #2?
am using pyrdfa version in examples:
http://www.w3.org/2007/08/pyrdfa/extract?uri=
not using version confuses sparql processors:
http://www.w3.org/2012/pyrdfa/extract?uri=
ty guidance here.
http://www.w3.org/2013/talks/0902-lisbon-ih/
uses rdfa 1.1, http://www.w3.org/2007/08/pyrdfa/extract?uri=
supports rdfa 1.0.
what using results in:
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:xml="http://www.w3.org/xml/1998/namespace" > <rdf:description rdf:about="talk:"> <xhv:icon rdf:resource="http://www.w3.org/2001/sw/favicon-sw.png"/> <xhv:stylesheet rdf:resource="http://www.w3.org/2006/02/charter-style.css"/> <xhv:stylesheet rdf:resource="http://www.w3.org/guide/pubrules-style.css"/> <xhv:copyright rdf:resource="http://creativecommons.org/licenses/by-nd/3.0/"/> </rdf:description> </rdf:rdf>
i.e. no triples of interest. because source declares prefixes using rdfa 1.1 @prefix
attribute, doesn't exist in rdfa 1.0. abbreviated urls broken according older parser.
with newer parser find many more triples, including:
... talk: ore:resourcemap; dc:author <http://www.ivan-herman.net/foaf#me>; dc:date "$date: 2013-08-27 07:51:24 $"; dc:title "introduction linked open data"; ore:describes <http://www.w3.org/2012/0902-lisbon-ih/#talk> . ...
which looking for.
however
as final fly in ointment 2 documents using different versions of dublin core namespace. rdfa 1.1 binds dc
prefix updated http://purl.org/dc/terms/
default, throws off query.
so try:
prefix dc: <http://purl.org/dc/terms/> # fixed dc prefix foaf: <http://xmlns.com/foaf/0.1/> select ?content ?author # use rdfa 1.1 parser <http://www.w3.org/2012/pyrdfa/extract?uri=http://www.w3.org/2013/talks/0902-lisbon-ih/> { ?s dc:author ?o . ?s dc:title ?content . ?o foaf:name ?author . } order ?content
tada, results.
Comments
Post a Comment