N3 method for path objects is bugged · Issue #2503 · RDFLib/rdflib (original) (raw)
The n3 method for path objects returns invalid/unexpected paths for non-trivial paths.
Example:
import rdflib
import rdflib.paths
path = rdflib.RDF.type / rdflib.paths.AlternativePath(rdflib.SKOS.note, rdflib.RDFS.comment)
Calling path.n3()
here returns <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>/<http://www.w3.org/2004/02/skos/core#note>|<http://www.w3.org/2000/01/rdf-schema#comment>
(essentially rdf:type/skos:note|rdfs:comment
).
However, it the method should rather return <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>/(<http://www.w3.org/2004/02/skos/core#note>|<http://www.w3.org/2000/01/rdf-schema#comment>)
(thus rdf:type/(skos:note|rdfs:comment)
).
The n3 method ignores all groups as it never introduces any brackets.
Related to #421