1

In the following example the trailing part of @id is computed from the data:

{
  "@context": "http://vocab.example/0.1/",
  "@type": "Foo",
  "foo": "bar",
  "@id": "https://host.example/ce157da859bbfba38d96ccaf080fa812/"
}

There is currently only one algorithm for computing this value so there is no sense in documenting the algorithm inside the data. However, in some future version this algorithm may change, so it would be beneficial for the context to express the algorithm that was used.

Unfortunately @id is a keyword with no associated behavior as a term, so it cannot be associated with an expressive @type such as, for the above example, CumputedUsingAlgorithmXYZ.

Ultimately I am looking for a way that will produce within the RDF for the above example probably something that means more or less this:

<https://host.example/ce157da859bbfba38d96ccaf080fa812/>
  <https://host.example/ce157da859bbfba38d96ccaf080fa812/@>
    "https://host.example/ce157da859bbfba38d96ccaf080fa812/"^^<http://vocab.example/0.1/CumputedUsingAlgorithmXYZ> .

Is there a way in json-ld to associate the value of @id with the additional type information, without adding to the data payload?

4
  • How big control do you have over the value of @id? Could you use a fragment to indicate the algorithm, or perhaps something in the path? That would be the usual solution to this. Commented Feb 19, 2024 at 16:20
  • @IS4 I have full control over the entire format, the point is that there is no sense in loading millions of messages with this metadata Commented Feb 19, 2024 at 16:47
  • What is wrong with https://host.example/AlgorithmXYZ/ce157da859bbfba38d96ccaf080fa812/ or similar? This is what common URI schemes already do, and it makes sense to put it in the identifier when it describes it. Commented Feb 19, 2024 at 17:59
  • @IS4 the algorithm is metadata, if the property was any term other than @id then the algorithm would have been defined as its @type, not its @value, thus being defined just once in the context and not carried on millions of messages without adding any relevant information. In formats that specify the algorithms as part of the payload, such as certificates, HMACs, etc., this information is necessary because there are multiple other options as well, but this is not my use case. Commented Feb 19, 2024 at 18:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.