triplestore
triplestore copied to clipboard
Decoding and loading multiple NT files with potential blank node name collisions
I'm interested in trying this library out to address a use case;
- I have multiple JSON-LD documents that I convert to NT
- These documents often have blank nodes in them which tend to be name _:b0 and on.
- However, this naming is across the various files and in some case the blank nodes are in the subject position.
- I currently use http://rdfpro.fbk.eu/ to combine these files and ensure the blank nodes are rewritten to be unique.
all other elements of this flow other than RDFPro is in Go and I would love to remove it.
If I load multiple NT files into a triplestrore obeject in your package do you re-write the blank nodes on load so that I don't loose/overwrite/miss-associate triples?
thanks!
Currently loading blank nodes with same name has no predictable behavior. So the use case is not supported.
It could be, though I think it would need:
- introduce an NT encoding mode so we can have both behavior: rewritten / ignoring conflict (for performance)
- strategy to rewrite blank nodes (ex: accept first blank node then
_1
,_2
,_3
suffixes)
@simcap Thanks for the update....
I like some of the triple store features you have, so I am going to see if there is some way I can deal with this blank node issue (they are always so fun) elsewhere in the chain. I'll monitor here too in case you address it sometime in the future.
I'm reading JSON-LD (schema.org) documents and using https://github.com/kazarena/json-gold to convert to ntriples. I might see if there is something I can do there to address the blank node issue as well.
Thanks!
Cool. Blank nodes collision is a bit of an edge case indeed. I will likely implement a solution (should be trivial) for it but I cannot give date or timeline as for now.
Also note - as indicated in the README - I have not implemented blank nodes and languages for binary serialization which I will do at some point.
Anyway thanks for using the library and do not hesitate to report any bugs, improvements.