Expand IRI in object position #876
Unanswered
multimeric
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
@multimeric have you been able to solve this? It is possible to alias {
"@context": {
"Foo": "https://example.org/Foo",
"class": "@type"
},
"class": "Foo"
}which becomes... _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/Foo> .But that of course doesn't map to Reading between all the lines, I think the main thing you're wanting is for a value-side IRI to have all the "short-hand" magic of an You're wanting the following to be possible... {
"@context": {
"Foo": {"@id": "https://example.org/Foo"},
"class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#class"}
},
"class": "Foo"
}but (sadly) only this is possible... {
"@context": {
"class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#class"}
},
"class": "https://example.org/Foo"
}Is that the main issue? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working with SHACL where
sh:classexpects the IRI of a class. Therefore, I wantsh:classto behave with the same magic properties as@type, so that it always treats its object as an IRI, and always expands it. The goal is to be able to do{"class": "Foo"}in the actual graph, with whatever@contexthacks are necessary. I'm finding this very difficult however. Can anyone suggest a solution?My attempts are below.
First I try just marking
classas taking an IRI, but this doesn't expandFoo:{ "@context": { "Foo": "https://example.org/Foo", "class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#Class"} }, "class": "Foo" }{ "http://www.w3.org/ns/shacl#Class": { "@id": "Foo" } }Trying to play with
Foo's own@typehas no effect, e.g.{ "@context": { "Foo": {"@type": "@id", "@id": "https://example.org/Foo"}, "class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#Class"} }, "class": "Foo" }Or
{ "@context": { "Foo": {"@type": "@vocab", "@id": "https://example.org/Foo"}, "class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#Class"} }, "class": "Foo" }The only hacky workaround I can find is to mark
Fooas a prefix and then also add a colon (which I don't want):{ "@context": { "Foo": {"@prefix": true, "@id": "https://example.org/Foo"}, "class": {"@type": "@id", "@id": "http://www.w3.org/ns/shacl#Class"} }, "class": "Foo:" }{ "http://www.w3.org/ns/shacl#Class": { "@id": "https://example.org/Foo" } }Beta Was this translation helpful? Give feedback.
All reactions