Document RDF/EDN
aamedina opened this issue · 0 comments
aamedina commented
Problem:
I need a way to serialize arbitrary RDF models as EDN.
Solution:
I use Apache Jena and Aristotle to read from some RDF source (could be JSON-LD, Turtle, RDF/XML etc.) and convert the triples into maps of subjects. The blank nodes are represented by subjects with a :db/id and named resources are given a :db/ident iff a prefix mapping exists at the time the RDF model is parsed by Jena. If no prefix mapping is found resources are identified by :rdfa/uri.
Typed literals are read as EDN tagged literals using the IRI of the datatype as the tag.
Language tagged literals are read as #rdf/langString "hello@en".
#rdf/List [:owl/Class :rdfs/Class]
=>
{:rdf/type :rdf/List,
:rdf/first :owl/Class,
:rdf/rest
{:rdf/type :rdf/List, :rdf/first :rdfs/Class, :rdf/rest :rdf/nil}}
Subsumes #6