RE: 2 RDFa SPARQL Test Harness Issues



> -----Original Message-----
> From: Manu Sporny [mailto:msporny@digitalbazaar.com]
> Sent: 17 May 2008 19:53
> To: RDFa mailing list; Seaborne, Andy; Benjamin Nowack
> Cc: Dave Beckett
> Subject: 2 RDFa SPARQL Test Harness Issues
>
> Hi all,
>
> This is a summary of all the current RDFa Test Harness issues that we
> have including a couple I found this morning. I'm cc'ing Andy and Benji
> in the hope that they have some insight into these issues. All test
> cases can be viewed via Crazy Ivan (RDFa Test Harness):
>
> http://rdfa.digitalbazaar.com/rdfa-test-harness/

>
> UTF-8 issues with ARC and SPARQL.org - TCs 60, and 108
> ------------------------------------------------------
>
> We currently have two test cases that use UTF-8 characters (TC#60 and
> TC#108). The SPARQL.org and ARC SPARQL engines both die processing
> queries containing multi-byte UTF-8 characters:
>
> Here's what SPARQL.org does:
> http://sparql.org/sparql?query=%EF%BB%BFASK+WHERE+%7B%0D%0A%09%3Chttp%3A%2F%2

> Fwww.example.org%2F%23matsumoto-
> kimiko%3E+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-
> ns%23type%3E+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E+.%0D%0A%09%3C
> http%3A%2F%2Fwww.example.org%2F%23matsumoto-
> kimiko%3E+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname%3E+%22%E6%9D%BE%E6%9C
> %AC+%E5%90%8E%E5%AD%90%22+.%0D%0A%7D&default-graph-
> uri=http%3A%2F%2Frdfa.digitalbazaar.com%2Flibrdfa%2Frdfa2rdf.py%3Furi%3Dhttp%
> 3A%2F%2Fwww.w3.org%2F2006%2F07%2FSWD%2FRDFa%2Ftestsuite%2Fxhtml1-
> testcases%2F0060.xhtml&stylesheet=%2Fxml-to-html.xsl

It starts with "\ufeffASK", i.e. a BOM.  You don't want the BOM - this is not a text file, it's a parameter string to a SPARQL request - and the query string be presented in UTF-8.  SPARQL is only defined for UTF-8.

Remove the BOM and the bomb will not go off.  I then get "ASK => true"

>
> We had not seen this issue until now due to a cut-paste issue in the
> Test Harness, which made both the XHTML and SPARQL queries look for "??
> ??" (four question marks separated by a space in the middle). The TCs
> were updated to use the proper UTF-8 characters, which broke the SPARQL
> engines. Andy, Benji - any chance that this could be fixed in the near
> future?
>
> False Positives in Test Harness with TCs 52, 53, and 58
> -------------------------------------------------------
>
> We currently have a couple of bnode tests showing a PASS when they
> should be FAIL. All test cases have what we thought was the proper way
> to check for a bnode's existence. This bug exists in librdfa and had not
> been caught until Dave Beckett pointed out an issue with these Test
> Cases and librdfa. I had erroneously replied stating that those test
> cases pass in the Test Harness (which they do, and they have always
> done). However, they should not be passing. Take TC #52, librdfa and
> SPARQL.org as an example. Here's the XHTML:
>
> ----------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
> "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:foaf="http://xmlns.com/foaf/0.1/">
>   <head>
>     <title>Test 0052</title>
>   </head>
>   <body>
>     <p typeof="foaf:Person" resource="http://www.example.org/#me">
>       John Doe
>     </p>
>   </body>
> </html>
> ----------------------------------------------------------------------
>
> librdfa produces the following RDF/XML, which is incorrect - the node
> should not contain an @rdf:about...
>
> ----------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <rdf:RDF
>  xmlns:foaf="http://xmlns.com/foaf/0.1/"
>  xmlns:xh1="http://www.w3.org/1999/xhtml/vocab#"
>  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> >
>  <foaf:Person rdf:about="http://www.example.org/#me">
>  </foaf:Person>
> </rdf:RDF>
> ----------------------------------------------------------------------
>
> but SPARQL.org, surprisingly says that there is a solution to the query.
>
> ----------------------------------------------------------------------
> ASK WHERE {
> _:a
>    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>       <http://xmlns.com/foaf/0.1/Person> .
> }
> ----------------------------------------------------------------------
>

That's looks right to me - bNodes in a SPARQL query are variables (unnamed existentals), not constants of the query.  For plain RDF, they match like any other variable.

That query is the same as

 ASK WHERE { ?x a <http://xmlns.com/foaf/0.1/Person> }

(bNodes match differently over OWL-DL as they can match an anonymous disjunction but this is not OWL-DL).

> This leads me to believe that the SPARQL above doesn't do what we think
> it does, but I haven't been able to find any documentation detailing how
> bnode identification happens in SPARQL queries.
>
> The question that we're attempting to ask above is "is there a bnode
> that has an rdf:type of foaf:Person?", not "is there any node that has
> an rdf:type of foaf:Person?".

Maybe something like:

ASK
{ ?x a <http://xmlns.com/foaf/0.1/Person>
  FILTER(isBlank(?x))
}

http://www.w3.org/TR/rdf-sparql-query/#func-isBlank



        Andy

>
> -- manu
>
> --
> Manu Sporny
> President/CEO - Digital Bazaar, Inc.
> blog: DB Launches Medical Record Sales Service with Shepherd Medical
> http://blog.digitalbazaar.com/2008/02/24/health2trade/

Received on Saturday, 17 May 2008 20:27:11 UTC