Frame Matching & Blank Nodes
The current draft for JSON-LD framing (January 2018) does not mention blank nodes in the frame matching algorithm specification and a strict interpretation of the first test goes a bit against the semantics of RDF in case a frame includes blank nodes:
1 Node matches if it has an
@idproperty value which is also a value of the@idproperty in frame.
According to its definition, a frame is a JSON-LD document, meaning it can include blank nodes. if it happens, blank nodes in the frame will match blank nodes in a document only if they have the same ID and I believe that the Ruby implementation performs simple string comparison.
In RDF, shared blank nodes require a special handling and we loose that specificity here. It would be good to either redefine JSON-LD frames such that blank nodes are not allowed or precise the specification of frame matching. I would be in favor of the latter approach.
Blank nodes in JSON-LD frames might be useful when nodes have multiple relations to each other. For instance, nodes matching the following frame represent all alumni of a university who still work for that university:
{
"@context": "http://schema.org",
"@type": "Person",
"alumniOf": {
"@id": "_:univ",
"@type": "CollegeOrUniversity"
},
"worksFor": { "@id": "_:univ" }
}
Blank nodes can be used within a frame, but they can't be used to match nodes in the document being framed. This is because framing causes the input document to be flattened, which renames BNodes. By extension, if a blank node is used in a frame for @id, it should fail, as it can (should) never match a node from another document.
Making this happen would push framing to be more like SPARQL BGP, where blank nodes become existential quantifiers, and that hasn't been the intention of the framing algorithm (although explored in #433 and #436.
The spec should probably be updated to either warn or prohibit the use of blank nodes in frame documents. @dlongley?
The spec should probably be updated to either warn or prohibit the use of blank nodes in frame documents.
:+1:
Closed via https://github.com/w3c/json-ld-framing/issues/9.