Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting to Triple Terms and Reifiers #49

Open
gkellogg opened this issue Mar 29, 2024 · 3 comments
Open

Adapting to Triple Terms and Reifiers #49

gkellogg opened this issue Mar 29, 2024 · 3 comments

Comments

@gkellogg
Copy link
Member

The direction for RDF 1.2 now abandons quoted triples for triple terms which are intended to be used indirectly through a reifier that relates an identifier to the triple term through rdf:reifies. This likely affects how we might represent this in JSON-LD. Rather than using a recursive value on @id, we may instead do something using additional keywords:

The bob example might look more like the following:

{
  "@context": {
    "@base": "http://example.org/",
    "@vocab": "http://example.org/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  },
  "rdf:reifies": {
    "@triple": {
      "@id": "bob",
      "age": 42
    }
  },
  "certainty": 0.8
}

This could be reduced by also introducing a @reifies keyword (at the expense of adding yet another keyword) as follows:

{
  "@context": {
    "@base": "http://example.org/",
    "@vocab": "http://example.org/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  },
  "@reifies": {
    "@id": "bob",
    "age": 42
  },
  "certainty": 0.8
}

The annotation syntax could also allow for an @id entry for assigning the reifier identifier:

{
  "@context": {
    "@base": "http://example.org/",
    "@vocab": "http://example.org/"
  },
  "@id": "bob",
  "age": {
    "@value": 42,
    "@annotation": {
      "@id": "_:anno",
      "certainty": 0.8
    }
  }
}
@pchampin
Copy link
Collaborator

  • Re. the representation of triple terms, I think I prefer the introduction of the @triple keyword over the overriding of the @id keyword. I believe that there are strong expectations that the value of @id is a string. Note also that ignoring the @triple keyword and its value would amount to replace triple-terms with blank nodes, which is a good fallback, IMO.

  • Exposing the rdf:reifies predicate and its triple-term value in JSON-LD feels against the trend to "hide" them in Turtle, and to encourage well-formed uses of triple terms. So I lean towards having a separate @reifies keyword, even if the fact that it exposes the word "reifies" (contrarily to the syntactic sugar in Turtle) is not entirely satisfactory, IMO...

  • +1 to allow @id in annotations to convey the reifier, that seems natural enough

@niklasl
Copy link
Member

niklasl commented Aug 18, 2024

  • Re. the representation of triple terms, I think I prefer the introduction of the @triple keyword over the overriding of the @id keyword. I believe that there are strong expectations that the value of @id is a string. Note also that ignoring the @triple keyword and its value would amount to replace triple-terms with blank nodes, which is a good fallback, IMO.

I definitely agree on not overriding @id (due to those probable strong expectations for it being a string).

  • Exposing the rdf:reifies predicate and its triple-term value in JSON-LD feels against the trend to "hide" them in Turtle, and to encourage well-formed uses of triple terms. So I lean towards having a separate @reifies keyword, even if the fact that it exposes the word "reifies" (contrarily to the syntactic sugar in Turtle) is not entirely satisfactory, IMO...

I also agree on avoiding exposing rdf:reifies (assuming we can stay on track with the well-formed baseline, and have that as the basis for JSON-LD).

I also lean towards a @reifies keyword (it could be named differently; though I am personally comfortable with "reifies", if we stay with that nomenclature). More on that in a follow-up comment.

  • +1 to allow @id in annotations to convey the reifier, that seems natural enough

Yes, definitely agree on that too; it comes naturally.

@niklasl
Copy link
Member

niklasl commented Aug 18, 2024

Interestingly, @reifies might work for all of these:

<< <x> :relation <y> ~ <ref-1> >> :p :o .

<ref-2> rdf:reifies <<( <x> :relation <y> )>> .

<z> :says << <x> :relation <y> ~ <ref-3> >> .

Which in JSON-LD could be this:

[
  {
    "@id": "ref-1",
    "@reifies": {
      "@id": "x",
      "relation": {"@id": "y"}
    },
    "p": {"@id": "o"}
  },
  {
    "@id": "ref-2",
    "@reifies": {
      "@id": "x",
      "relation": {"@id": "y"}
    }
  },
  {
    "@id": "z",
    "says": {
      "@id": "ref-3",
      "@reifies": {
        "@id": "x",
        "relation": {"@id": "y"}
      }
    }
  }
]

One upshot is that, IMHO, JSON-LD isn't as "triple-oriented" as Turtle; and the above reifications are more like a "neutral" singleton objects if you will (or even "quoted" data, meant without any opacity connotation).

Note though that this relies on all data being within the well-formed constraints for triple terms, i.e. only <<( ... )>> as objects of rdf:reifies. I think that is a good thing for JSON-LD, but it needs to be kept in mind.

I even think it can be beneficial, and simple enough, to allow @reifies to contain multiple "triples". For example, this:

{
  "@id": "ref-4",
  "@reifies": {
    "@id": "x",
    "firstName": "X",
    "lastName": "XY"
  },
  "p": {"@id": "o"}
}

Would be, in Turtle:

<< <x> :firstName "X" ~ <ref-4> >> .
<< <x> :lastName "XY" ~ <ref-4> >> .
<ref-4> :p :o .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants