Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add positive and negative SPARQL 1.2 triple terms syntax tests #144

Merged
merged 10 commits into from
Oct 25, 2024

Conversation

rubensworks
Copy link
Member

@rubensworks rubensworks commented Sep 25, 2024

As part of #140, this PR adds positive and negative syntax tests related to the new triple terms in SPARQL 1.2.
Evaluation tests are not included yet in this PR.

Some notes on this:

  • Tests are derived from the SPARQL star tests, and repeated as reifier, anonreifier, and tripleterm in the test name where applicable.
  • The SPARQL 1.1 syntax tests (positive and negative) are all captured in a single manifest. Here, I opted to split positive and negative, and have dedicated directories for triple terms. This attempts to separate tests by feature, similar to how SPARQL 1.1 already did this for evaluation tests.
  • This PR makes use of the existing SPARQL 1.1-specific test classes. SPARQL syntax test classes in test manifest vocabulary include version in IRI (11) #143 needs to be resolved first if we don't want this.
  • All of these tests in my fork of SPARQL.js, but it would be good if someone can double-check correctness in another implementation.

@rubensworks
Copy link
Member Author

@afs Your comment regarding compound-all.rq has been resolved. I still need to look into the other issues next.

@rubensworks rubensworks force-pushed the feature/sparql-triple-terms branch from f116dfa to fef7c5d Compare October 3, 2024 15:04
@rubensworks
Copy link
Member Author

Reified triple declaration tests (positive and negative) have also been added.
I still need to add tests for multiple reifier ids in annotation syntax next.

@rubensworks
Copy link
Member Author

Thanks for the reviews, all comments should be resolved now.

@afs I've also added some tests for multiple reifiers in annotation syntax (which is the reason this took me a while, as I didn't have this properly supported in SPARQL.js yet...)

@rubensworks
Copy link
Member Author

Regarding the comment on #140 by @afs:

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.

The grouping of all update-related tests in a single (or two) directory seemed a bit weird to me, since for non-update tests a feature-based directory grouping was chosen. So I opted for a pure feature-based directory grouping here.

I've split the positive and negative tests in separate directories to make management of the test manifest easier.

But I don't have a strong opinion on this, so I'm happy to move things around.

Comment on lines +7 to +8
# TODO: See if this should be throwing an error
<< _:b ex:x () >> ex:broken true .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the suggestion here that () shouldn't parse as rdf:nil and be disallowed because you shouldn't be able to reify a triple with a list as an object?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was derived from the RDF-star tests.
I suspect you are right.
But I wonder if we really want/need to disallow this.
A message on this exact topic was also just raised on the mailinglist.

@afs perhaps you have some more insights on this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also w3c/rdf-ucr#26 ("Example 3: RDF Lists").

Copy link
Contributor

@afs afs Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the suggestion here that () shouldn't parse as rdf:nil and be disallowed because you shouldn't be able to reify a triple with a list as an object?

Yes. The only meaning would be to assert the triples into the graph. RDF Collections are messy. In N3, collections are first-class citizens but not in RDF 1.x.

The idea is to keep triple terms as terms, without additional triples asserted in to a graph.
<<:s :p :o >> becomes _:r rdf:reifies <<( :s :p :o )>> -- <<...>> usage is connected to triple terms.

In SPARQL, a query expression can create terms outside a graph. No lists one or greater, no predicate object lists.

In annotation syntax, it is more reasonable to put the asserted triples in the graph although it only puts the head blank node into the triple term.
-- w3c/rdf-ucr#26 ("Example 3: RDF Lists") -- but << >> is not asserting.

() is an odd case because it is a term whereas any other list has triples. It can't occur in expressions as rdf:nil.

See also:

Comment on lines +7 to +8
# TODO: See if this should be throwing an error
<<( _:b ex:x () )>> ex:broken true .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here as with list-anonreifier-01 – is this about ()/rdf:nil?

Copy link

@niklasl niklasl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be beneficial to move positive tests involving triple terms as subjects (here commented) to a "generalized RDF" feature set?

@rubensworks
Copy link
Member Author

Would it be beneficial to move positive tests involving triple terms as subjects (here commented) to a "generalized RDF" feature set?

@niklasl I've raised a new issue to discuss this topic: #149

This makes the SPARQL syntax test classes more flexible towards future
spec versions.

Closes w3c#143
@rubensworks rubensworks self-assigned this Oct 23, 2024
Copy link
Member

@gkellogg gkellogg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My implementation passes all these tests, although the test entry types should be changed as I suggested in #143 (comment).

@afs
Copy link
Contributor

afs commented Oct 24, 2024

@kasei pointed out that reverse paths means that subject and object positions should be the same. This isn't a generalized RDF issue.

@afs
Copy link
Contributor

afs commented Oct 24, 2024

My implementation passes the current PR when adding #UpdateSyntaxTest and #NegativeUpdateSyntaxTest.

@afs
Copy link
Contributor

afs commented Oct 24, 2024

@gkellogg The report generation is failing. Is this because the PR branch is not in the repository?

From https://github.com/w3c/rdf-tests
 * [new branch]      feature-iri-resolution -> origin/feature-iri-resolution
 * [new branch]      fix-protocol-manifest  -> origin/fix-protocol-manifest
 * [new branch]      fix-results-tests      -> origin/fix-results-tests
 * [new branch]      index-redirects        -> origin/index-redirects
 * [new branch]      main                   -> origin/main
 * [new branch]      original-tests         -> origin/original-tests
 * [new branch]      pfps-sparql-exists     -> origin/pfps-sparql-exists
 * [new branch]      resolution             -> origin/resolution
fatal: invalid reference: feature/sparql-triple-terms

@gkellogg
Copy link
Member

@gkellogg The report generation is failing. Is this because the PR branch is not in the repository?

From https://github.com/w3c/rdf-tests
 * [new branch]      feature-iri-resolution -> origin/feature-iri-resolution
 * [new branch]      fix-protocol-manifest  -> origin/fix-protocol-manifest
 * [new branch]      fix-results-tests      -> origin/fix-results-tests
 * [new branch]      index-redirects        -> origin/index-redirects
 * [new branch]      main                   -> origin/main
 * [new branch]      original-tests         -> origin/original-tests
 * [new branch]      pfps-sparql-exists     -> origin/pfps-sparql-exists
 * [new branch]      resolution             -> origin/resolution
fatal: invalid reference: feature/sparql-triple-terms

I will look into it; could be transitory.

:alternate-path-anonreifier rdf:type mf:NegativeSyntaxTest ;
dawgt:approval dawgt:Proposed ;
mf:name "alternate-path-anonreifier.rq" ;
mf:specVersion "sparql-1.2";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have IRIs for the different SPARQL language versions (via the service description spec). I'd personally prefer if we used those instead of literals here. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have IRIs for the different SPARQL language versions (via the service description spec). I'd personally prefer if we used those instead of literals here. Thoughts?

@kasei Would you be OK with raising that as separate issue, either one it's own or one to cover all manifest vocabulary changes? This is to let the test material go in - it's big PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, totally fine if that's handled later.

@afs
Copy link
Contributor

afs commented Oct 24, 2024

We discussed this PR in the WG meeting 2024-10-24 (brief minutes)

It was noted that there are sub-parts on the tests themselves and on the test manifest vocabulary.

The WG would be happy if the tests were merged and issues subsequently raised. The decision is left to this group.

@kasei
Copy link
Contributor

kasei commented Oct 24, 2024

I also have an implementation passing all of these tests. Happy for this to get merged now.

@rubensworks
Copy link
Member Author

I agree with merging this PR in its current form, and discussing remaining issues through separate issues.

Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge it. Big improvement over status quo. Nothing prevents further fine tuning of issues, whether remaining after or caused by this PR.

@niklasl
Copy link

niklasl commented Oct 24, 2024

I also agree.

@gkellogg
Copy link
Member

@gkellogg The report generation is failing. Is this because the PR branch is not in the repository?

From https://github.com/w3c/rdf-tests
 * [new branch]      feature-iri-resolution -> origin/feature-iri-resolution
 * [new branch]      fix-protocol-manifest  -> origin/fix-protocol-manifest
 * [new branch]      fix-results-tests      -> origin/fix-results-tests
 * [new branch]      index-redirects        -> origin/index-redirects
 * [new branch]      main                   -> origin/main
 * [new branch]      original-tests         -> origin/original-tests
 * [new branch]      pfps-sparql-exists     -> origin/pfps-sparql-exists
 * [new branch]      resolution             -> origin/resolution
fatal: invalid reference: feature/sparql-triple-terms

I will look into it; could be transitory.

So, I believe the problem is that the PR is from a forked repository, and stefanzweifel/git-auto-commit-action@v4 seems to expect that it is a local branch? Anyway, I would just merge it and some future PR will end up rebuilding the HTML manifests.

Generally, I prefer that PRs come from local branches, but that requires write permission from the authors, which shouldn't be a problem.

@rubensworks rubensworks merged commit 831feb1 into w3c:main Oct 25, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants