Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Arbitrary JSON-LD for topics in API #291

@ptgolden

Description

@ptgolden

How should we represent this in Topics' JSON-LD representations?

I'll start from this example topic:

{
   "@context": {
        "url": "@id"
    }
    "url": "http://workingnotes.org/projects/emma/topics/4/"
}

Let's say that someone wants to add a triple whose subject is this topic, predicate is http://example.org/v#color and object is the string literal "green".

The simplest way to do this would be to just extend the API's representation of the topic:

{
   "@context": {
        "url": "@id"
    }
    "url": "http://workingnotes.org/projects/emma/topics/4/",
    "http://example.org/v#color": "green"
}

However, I think it makes sense to fence extra properties (i.e. not ones built in to Editors' Notes) into their own namespace, with its own context. That might look something like this:

{
   "@context": {
        "url": "@id",
        "structuredData": "@graph"
    },
    "url": "http://workingnotes.org/projects/emma/topics/4/",
    "structuredData": {
        "@context": {
            "color": "http://example.org/v#color"
        },
        "@id": "http://workingnotes.org/projects/emma/topics/4/",
        "color": "green"
    }
}

In this case, we have to repeat @id to set a subject for the statements in the @graph. That results in the following nquad:

<http://workingnotes.org/projects/emma/topics/4/> <http://example.org/v#color> "green" <http://workingnotes.org/projects/emma/topics/4/> .

Is that nonsensical, defining an RDF object as the subject of its own named graph?

If json-ld/json-ld.org#246 were a reality, we could set structuredData in the @context to be @index rather than @graph, making it a semantically meaningless grouping. However, that's not possible with the current JSON-LD standard.

I still think this second approach makes the most sense, because it makes it clear which properties are user-defined and which are EN-defined. It would be nice to be able to say, in effect: "here's your own JSON-LD space to do whatever you want."

Any other ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions