You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal would be to be able to address document values with this syntax stratified_doc[triple.subject][triple.predicate] or even better stratified[triple.graph][triple.subject][triple.predicate].
This could also be a @stratified parameter for expansion.
// Access a triple from the default graphvarcreator=stratified['@graph']['http://example.org/graph/0']['http://purl.org/dc/elements/1.1/creator'];// "Jane Doe"// Access a triple in a named graphvartype=stratified['http://example.org/graph/0']['http://example.org/library']['@type'];// "http://example.org/vocab#Library"// Before submitting a document, mutate a propertystratified['http://example.org/graph/0']['http://example.org/library/the-republic']['@type']='http://example.org/vocab#Book';// Or using an immutable spread syntax approachvarnew_doc={
...stratified,'http://example.org/graph/0': {
...stratified['http://example.org/graph/0'],'http://example.org/library/the-republic' : {
...stratified['http://example.org/graph/0']['http://example.org/library/the-republic'],'@type': 'http://example.org/vocab#Book'}}}
The text was updated successfully, but these errors were encountered:
This looks similar to the @id maps feature that was added recently (see Node Identifier Indexing. But, that hasn't been extended to graphs quite yet. There is a separate issue on an @graph container #195. You might look at these in the current spec drafts to see how they might handle your use case.
Hi there,
I was looking for a way to access properties in a JSON-LD document based on triples (to patch the document). This would mean having a view which creates a dictionary for a given document. The term Normalisation is already used, but this approach would be close to the way https://github.com/paularmstrong/normalizr. D3 uses https://github.com/d3/d3-hierarchy/blob/master/README.md#stratify in a slightly different way but with the same general intent.
The goal would be to be able to address document values with this syntax
stratified_doc[triple.subject][triple.predicate]
or even betterstratified[triple.graph][triple.subject][triple.predicate]
.This could also be a
@stratified
parameter forexpansion
.Example
For a document:
Such a
stratified
would therefore look like:This would therefore allow to do the following:
The text was updated successfully, but these errors were encountered: