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

Update grammar for quoted triples and triple functions #78

Merged
merged 2 commits into from
May 25, 2023

Conversation

afs
Copy link
Contributor

@afs afs commented May 18, 2023

Part of issue #53 (Incorporate RFD-star CG report)

This is the SPARQL Grammar changes, and only those changes, to replace the table in section 19.8.

This is not directly the content from the CG report because the complete SPARQL grammar in the report has various errors and omissions. The fragment earlier in the report is closer.


Preview | Diff

@afs afs added the spec:substantive Issue or proposed change in the spec that changes its normative content label May 18, 2023
@afs afs self-assigned this May 18, 2023
@afs
Copy link
Contributor Author

afs commented May 19, 2023

Online validator: https://www.sparql.org/query-validator.html

Note: this service is to not guaranteed to be available. The service does occasional experience (accidentally) DOS attacks and may become uncontactable. All we can do is wait.

Syntax features illustration:
Query:

PREFIX :        <http://example/>

SELECT ?x (<<?s ?p ?o >> AS ?T) {
    VALUES ?a { <<:s :p :o >> }
    VALUES (?a ?b)  {
        ( <<:s1 :p1 :o1 >>  123 )
        ( 456 <<:s2 :p2 :o2 >> )
    }

     <<?s :p ?o >> :q1 123 ;
                   :q2 [ :r <<?s :p ?o >>  ] .
                   
     <http://example/x> :q <<?s :p ?o >> .

      <<?s :p ?o >> <http://example/p> <<?s :p ?o >> .

     ?s ?p ?o .
     BIND( <<?s ?p ?o >> AS ?qtriple0 )
     BIND( triple(?s , ?p , ?o) AS ?qtriple )
     FILTER( isTriple(?qtriple) )
     FILTER( subject(?qtriple) )
     FILTER( predicate(?qtriple) )
     FILTER( object(?qtriple) )
}

Update:

PREFIX :        <http://example/>

INSERT DATA { <<:s :p :o >> :q 123 . }
;
INSERT { << ?s ?p ?o >> :r "abc" }
WHERE  { ?s ?p ?o }

@hartig
Copy link
Contributor

hartig commented May 19, 2023

Online validator: https://www.sparql.org/query-validator.html

Great!!

@afs
Copy link
Contributor Author

afs commented May 19, 2023

HTML now indented.

The content is ready for review and we can get the grammar so it gets into the WD and also can be used for the rest of #53.

There are some rules that need more layout tuning. This is not new to 1.2 but due to reSpec being narrower than the SPARQL 1.1 doc it stands out more.

@afs afs marked this pull request as ready for review May 19, 2023 13:48
Tpt added a commit to oxigraph/oxigraph that referenced this pull request May 19, 2023
@Tpt
Copy link
Contributor

Tpt commented May 19, 2023

Thank you!

I have tested the grammar as written in this PR with Oxigraph and it seems to work.

Two nitpicks:

  • All terminal rule names are now displayed between < and > except IRIREF.
  • Would not add QuotedTriple to the GraphTerm rule but to the VarOrTerm rule to keep the GraphTerm rule focused on RDF terms without variables in them. But it's a personal test, please ignore this comment if you feel it's not relevant.

@gkellogg
Copy link
Member

Agree that terminals should not be enclosed in angle brackets.

@afs
Copy link
Contributor Author

afs commented May 19, 2023

All terminal rule names are now displayed between < and > except IRIREF.

Mistake fixed.

@afs
Copy link
Contributor Author

afs commented May 19, 2023

Would not add QuotedTriple to the GraphTerm rule but to the VarOrTerm rule to keep the GraphTerm rule focused on RDF terms without variables in them.

Yes - and as its now recursive on variables, GraphTerm can be pulled up into VarOrTerm (single use). This makes it more like
DataBlockValue.

Tpt added a commit to oxigraph/oxigraph that referenced this pull request May 20, 2023
@rubensworks
Copy link
Member

Online validator: https://www.sparql.org/query-validator.html

@afs I noticed that this query validator doesn't accept update queries (also not regular 1.1 update queries), is this intentional?

@afs
Copy link
Contributor Author

afs commented May 22, 2023

There is a separate validator: https://www.sparql.org/update-validator.html

Updates are not queries in SPARQL.

@afs
Copy link
Contributor Author

afs commented May 25, 2023

The force push is a rebase with current main after several other changes to check this PR branch to check before merging.

@afs afs merged commit 7a86e59 into main May 25, 2023
1 check passed
@afs afs deleted the quoted-triples-grammar branch May 25, 2023 17:17
@gkellogg
Copy link
Member

It would be nice to have the raw EBNF used to generate the HTML grammar table somewhere in the repository.

@afs
Copy link
Contributor Author

afs commented May 30, 2023

https://github.com/apache/jena/tree/main/jena-arq/Grammar

It's managed, and tested, using JavaCC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:substantive Issue or proposed change in the spec that changes its normative content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants