w3c / rdf-tests

Repository for the RDF Tests Community Group
w3c.github.io/rdf-tests
Other
44 stars 23 forks source link

Add SPARQL tests for new triple term and reification syntax #140

Open rubensworks opened 1 week ago

rubensworks commented 1 week ago

New tests should be added, inspired by the sparql-star tests.

rubensworks commented 1 week ago

@afs Just letting you know that I started working on creating syntax tests, to avoid duplicate parallel effort.

afs commented 1 week ago

Excellent! Thanks for coordinating.

I have recently finished the set of changes for current RDF 1.2.

There is a fix needed in the grammar (nested reified triples). https://github.com/w3c/rdf-turtle/issues/71 affects the grammar.

I don't have any scripted tests.

I have some development syntax tests (current temporary location for RDF 1.2 tests) in ${programming language}. They focus on specific details and are not checked for comprehensive coverage which I hope to use rdf-tests tests for.

afs commented 1 week ago

PR https://github.com/w3c/sparql-query/pull/153 updated.

afs commented 5 days ago

Awesome set of tests!

Jena passes all except:

The first two are more like spec bugs: see https://github.com/w3c/sparql-query/issues/157

syntax-triple-terms-negative/list-anonreifier-01.rq
     8      << _:b ex:x () >> ex:broken true .

() - rdf:nil - is a term (in VarOrTerm) rather than a compound list. Hence it is included.

It is not legal in Turtle - Turtle (1.1) handles collections differently to SPARQL which has NIL as a parser token.

We can change the grammar to match the tests. https://github.com/w3c/sparql-query/issues/157

syntax-triple-terms-negative/list-tripleterm-01.rq`
     7      # TODO: See if this should be throwing an error
     8      <<( _:b ex:x () )>> ex:broken true .

Ditto except in triple terms. https://github.com/w3c/sparql-query/issues/157.

syntax-triple-terms-positive/compound-all.rq 
     7    << <<(:x ?R :z )>> :p <<:a :b [] >> ~ _:bnode >>

This a triple term as subject.

While it will be allowed via variables, as are literals, I think we should make this a negative test.

rubensworks commented 5 days ago

syntax-triple-terms-positive/compound-all.rq This a triple term as subject. While it will be allowed variables, as are literals, I think we should make this negative test.

Ah right, that should be disallowed. I'll look into making that specific case a negative test, but modify syntax-triple-terms-positive/compound-all.rq to remain a positive one to still test the combination of triple terms and reifiers.

afs commented 5 days ago

This is unused and should be removed :: @prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> . Unfortunately, this is also in SPARQL 1.1. - no uses of the prefix and SPARQL 1.0 in some mf:requires. Raised: https://github.com/w3c/rdf-tests/issues/145

afs commented 5 days ago

Discussion point:

The SPARQL 1.1 are organised separated by query vs update as syntax-query/ and syntax-update-1/ syntax-update-2/. Positive and negative tests are in the same directory.

Should the SPARQL 1.2 test be organised in a similar fashion?

afs commented 5 days ago

Missing: (I didn't see these but that may be my mistake - many tests!)

1:: I don't see many reified triple declaration syntax tests, only syntax-triple-terms-positive/compound-anonreifier.rq.

SELECT * {
    <<?s ?p ?o >> .
}

2:: Multiple reifier ids in annotation syntax: declaration of reifier ids and annotation blocks can be fixed.

:s :p :o ~ :r1 ~ :r2 .
:s :p :o ~ :r1 {| :y :z |} ~:r2 {| :y :z |} .
:s :p :o ~ :r1 {| :y :z |} ~:rx ~:r3 {| :y :z |} ~:ry .

(~:rx declares a reified id, which isn't immediately used.)

These are likely rare cases but are in the draft grammar.

rubensworks commented 5 days ago

Right, we need more of those. Especially also multiple reifier ids in annotation syntax, because we don't have any tests yet for those indeed.

afs commented 5 days ago

expr-tripleterm-02.rq : triple term as subject in <<( )>>- spec bug. https://github.com/w3c/sparql-query/issues/158

However I suspect TRIPLE(<<(:s :p :o)>> , ... , ....) not fixable.

afs commented 5 days ago

My bad. Some/all of these comments should be on the PR not the issues. I will see if comments can be moved. If not, shall I delete them here and recreate on the PR?

rubensworks commented 5 days ago

Either option is fine by me, I'll find the comments once I continue working on the tests :-)