SWI-Prolog / packages-semweb

The SWI-Prolog RDF store
28 stars 14 forks source link

Cannot parse graph keyword in TRiG #85

Closed wouterbeek closed 5 years ago

wouterbeek commented 5 years ago

The following cannot be parsed by turtle.pl:

graph <g:g> {
  <s:s> <p:p> <o:o>.
}

The graph keyword is allowed in the TRiG grammar but is not yet implemented by the parser.

JanWielemaker commented 5 years ago

Thanks. Fixed with 54273b6644d1c8c964271b9cb56d7964183794dc. Not perfect as it basically simply ignores a GRAPH keyword in a place where it may appear, which implies you do not have to start a graph afterwards. Fixing that requires some nasty state management in the current design.

wouterbeek commented 5 years ago

@JanWielemaker This fix does not work when the graph term is a prefixed IRI with alias graph:

prefix graph: <x:x>
graph graph:x {
  <x:x> <x:x> <x:x>.
}

or

prefix graph: <x:x>
graph:x {
  <x:x> <x:x> <x:x>.
}
JanWielemaker commented 5 years ago

I see. Guess I need a proper test that the graph keyword is indeed followed by a graph.

wouterbeek commented 5 years ago

Thanks Jan, this seems to work fine now.