Is it possible to reference a property on a blank node? In the following example, what would be the way to express that Secret Agent 2
knows that the email [email protected]
belongs to Secret Agent 1
? The following is based on this example for blank nodes
{
"@context": "http://schema.org/",
"@id": "_:n1",
"name": "Secret Agent 1",
"email": "[email protected]", //the property I want to add
"knows": {
"name": "Secret Agent 2",
"knows": {
"@id": "_:n1"
},
"knowsAbout": { //Agent 2 knows that an email
"@id": "_:n1#email" //is the contact for Secret Agent 1
} //and that the email is "[email protected]"
}
}
When trying that in the json-ld playground, the bit with "@id": "_:n1#email"
is interpreted as a new node _:b2
which doesn't exist
You can't really do this in JSON-LD, or really in RDF in general. This document describes two entities each with a set of properties and assets that each knows the other. The relationship is between entities, and not about specific properties of those entities.
You could make the email address, itself, an entity, and then claim some relationship to it. For example, schema.org has a PropertyValueSpecification, which is can have an @id
, and therefore could be referenced, but that is not how I would choose to model it.
JSON-LD-star is a proposed specification for describing the properties of relationships themselves (a variation on RDF-star), so you could create the relationship _:n1 :email "[email protected]"
as an entity, but this doesn't really get to the indirection you describe. Still, it could look something like the following:
{
"@context": "https://schema.org",
"@id": "_:n1",
"email": "[email protected]",
"knows": {
"name": "Secret Agent 2",
"knows": {
"@id": "_:n1"
},
"knowsAbout": {
"@id": {
"@id": "_:n1",
"email": "[email protected]"
}
}
}
}
But note that these are just proposed standards.
If you were to use the PropertyValueSpecification
indirection (or some similar piece of modeling), you could say that you know about the email and it's relationship to _:n1
without divulging the actual email, itself, but this is definitely non-typically data modeling.