Open josephguillaume opened 6 months ago
You are right, PodOS mostly assumes named nodes currently and I did not spent much thoughts on blank nodes(yet). I am trying to avoid them as described in your workaround.
Some things come to my mind, but the whole blank node situation must be carefully thought through:
uri
attribute to refer to a blank node is definitely not right, we either need to rename it or add another attribute to handle blank nodeMy current use case actually relates to collections - my list component creates pos-resource elements and sets their uri. Calling lazy=true suppresses fetching but allows descendants to receive the resource.
If it's a blank node, the uri starts with an underscore, e.g. _g_L9C317
Options for renaming would be resource or about. consistent with https://www.w3.org/TR/rdfa-lite/#resource or https://www.w3.org/TR/rdfa-primer/#alternative-for-setting-the-context-about PodOS has the potential for its DOM to become valid RDFa.
Just checking now, it turns out RDFa supports explicitly defining blank nodes, which would work well for our case here. https://www.w3.org/TR/rdfa-core/#s_blankNodes
There might be an architectural decision to make here. I'll describe my use case and current blockers.
I use pos-resource to make a resource available to descendants. This includes creating pos-resource elements and setting their uri programmatically (usually with lazy=true)
When the resource is a blank node, pos-resource errors with e.g. NamedNode IRI "_g_L9C317" must be absolute
I would need to confirm, but it appears the error is thrown by os.store.get when checking editable, which in turn assumes that the Uri is a named node: https://github.com/linkeddata/rdflib.js/blob/cd9a5960ef01bf9350c55a349db4410bc029a796/src/update-manager.ts#L154
There are other places that the PodOs code currently assumes a Uri is a named node/sym, e.g. https://github.com/pod-os/PodOS/blob/e4904287890fa3c03a37fb485d0b78ddd893cc34/core/src/thing/Thing.ts#L99
Current workaround is to rewrite data to avoid using blank nodes.
Issues to address: