anusii / rdflib

A pure Dart package for working with RDF (resource description framework).
https://pub.dev/packages/rdflib
GNU General Public License v3.0
15 stars 3 forks source link

RDFLib: fix ':' and '@base' in namespace prefixes #9

Closed tian3rd closed 1 year ago

tian3rd commented 1 year ago

When the turtle file contains : or @base in the namespace prefixes, they'll be ignored in current RDFLib implementation. Need to save them in the graph, and parse and serialize correctly in the Graph class.

tian3rd commented 1 year ago

Updated change-log for RDFLib package:

tian3rd commented 1 year ago

For example, if we have base <http://www.example.com/> . and a triple of <bob#me> rdf:type owl:NamedIndividual ., we now can interpret the subject <bob#me> correctly and save the triple to the graph. And when exporting back to external file, it will be in the form of <bob#me> as well (instead of the full uri)

tian3rd commented 1 year ago

Example file 1: https://github.com/anusii/rdflib/blob/main/example/ex_base.ttl as an input Example file 2: https://github.com/anusii/rdflib/blob/main/example/ex_base_output.ttl as the output file

Read Example file 1 into the Graph, and serialize the Graph to a turtle file Example file 2.

gjwgit commented 1 year ago

Looks good - so RDFLib can now do this - read's file 1 and writes file 2. If that is the case we can close this issue now.