Reputation: 1431
I am fairly new to JSON-LD and currently getting familiar with the concept of IRI. I have a schema, saying a very simple one:
{
"@context": {
"ex": "http://example.com/",
"Person": {
"@id": "ex:Person",
"@type": "@id"
},
"name": "ex:name",
"age": "ex:age",
"address": "ex:address"
}
}
My question is how do impose a specific IRI structure every time I create an instance of Person? Is there a way to do so? Can this be done programmatically in a JSON-LD schema? For example, I would like that my IRIs to look like this:
ex:Person/aSpecificPerson/aVersion
I was looking at examples such as Azure Digital Twins, but I am struggling to come up with an approach that, no matter what the resource is, would programmatically create IRIs of a specific format for instances, properties etc.
Thank you
Upvotes: 0
Views: 40
Reputation: 1020
Generally, you can have an internal library for minting your resource IRI's. Maybe it's an IRI factory, IRI API, etc that provides IRI's to your specification. This helps cut down on bugs, but you'll also want to run a regular expression on the IRI itself.
You might be able to use jq (or some other tool) to filter IRI's by regular expression. If it's empty, the you know that the test didn't pass.
The semantic web way would be to write SHACL that tests the IRI structure against a regex expression.
Upvotes: 0