Skip to content

ExprTripleTermSubject grammar rule allows to write always invalid expression #283

@Tpt

Description

@Tpt

The current SPARQL grammar states:

[137]  ExprTripleTerm  ::=  '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>'
[138]  ExprTripleTermSubject  ::=  iri | RDFLiteral | NumericLiteral | BooleanLiteral | Var | ExprTripleTerm

And the Triple( function for which ExprTripleTerm is a syntactic sugar is defined using: If the 3-tuple (subj, pred, obj) is an RDF triple (that is, subj is an IRI or blank node; pred is an IRI; and obj is an IRI, triple term, blank node or literal) the function returns a triple term with these three elements. Otherwise, the function raises an error..

It means that expressions like <<( "foo" ex:p "bar" )>> will always return an error at runtime. I tend to think it might be nicer to make them invalid syntax and change the grammar into:

[137]  ExprTripleTerm  ::=  '<<(' ExprTripleTermSubject Verb ExprTripleTermObject ')>>'
[138]  ExprTripleTermSubject  ::=  VarOrIri

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions