Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should pos-resource support blank nodes? #35

Open
josephguillaume opened this issue Mar 31, 2024 · 2 comments
Open

Should pos-resource support blank nodes? #35

josephguillaume opened this issue Mar 31, 2024 · 2 comments

Comments

@josephguillaume
Copy link
Contributor

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.

value = this.store.anyValue(sym(this.uri), sym(it));

Current workaround is to rewrite data to avoid using blank nodes.

Issues to address:

  • Should it be possible to specify a blank node as URI for pos-resource (with lazy=true)?
  • If yes, how should editable status be determined for blank nodes? E.g. how is this usually handled by rdflib.js?
  • If yes, what other changes/tests are required?
  • If no, what is the preferred mechanism to access the relations of a blank node within PodOS?
@angelo-v
Copy link
Contributor

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:

  • a blank node is also a resource just without a name (URI), so pos-resource could apply
  • using 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 node
  • how would one refer to blank nodes?
  • pos-resource does 2 things: fetch and set the context for siblings. Fetching does not apply to blank nodes
  • we also need to consider collections, it is another but maybe similar topic

@josephguillaume
Copy link
Contributor Author

My 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants