Context
I am trying to collect a set of requirements and record them in JSON-LD format. The JSON-LD document will serve as a configuration file to drive automated data analysis in the short term. In the long term, my boss hopes to leverage the underlying RDF graphs of this configuration and other documents we are also generating in JSON-LD. Not sure what he plans to do exactly, but he’s got a big brain so I’m just in charge of the short-term.
Problem/Question
Question in the title. I am getting twisted around the axel trying to figure out how to correctly expand property values into meaningful URI/URLs. It seems easy enough to expand property names, but I want the values of those properties to expand.
What I’ve tried
I’ve spent two days in the JSON-LD sandbox and this is what I have to show for my effort:
{
"@context" : {
"number" : "locator:requirements/number/",
"var" : "locator:models/"
},
"@graph" : [
{
"@id" : "number:001",
"target" : {
"@type" : "float",
"@value" : 22.6
},
"variable" : {
"@id" : "var:StarTracker/AngleToSun"
},
"operator" : "minimum"
}
]
}
Which I would like to expand to:
[
{
"@id": "locator:requirements/number/001",
"operator": [
{
"@value": "minimum"
}
],
"target": [
{
"@type": "float",
"@value": 22.6
}
],
"variable": [
{
"@id": "locator:models/StarTracker/AngleToSun"
}
]
}
]
Following the advice of this answer, I used @vocab
to make some small progress. However, it appears that @vocab
signifies a default URI, which gets applied to EVERYTHING, not just the bits that I want it to. With my new context
"@context" : {
"@vocab" : "locator:requirements/number/",
"number" : "locator:requirements/number/",
"var" : "locator:models/"
}
I now get this expansion, with lots of stuff that I don’t want.
[
{
"@id": "locator:requirements/number/001",
"locator:requirements/number/operator": [ <------------ UNWANTED EXPANSION
{
"@value": "minimum"
}
],
"locator:requirements/number/target": [ <-------------- UNWANTED EXPANSION
{
"@type": "locator:requirements/number/float", <---- UNWANTED EXPANSION
"@value": 22.6
}
],
"locator:requirements/number/variable": [ <------------ UNWANTED EXPANSION
{
"@id": "locator:models/StarTracker/AngleToSun"
}
]
}
]
I realize now that @vocab
is a “default” expansion, and so is not what I should be using. How do I do this the right way?