-
Notifications
You must be signed in to change notification settings - Fork 8
Proposal: Named Node Expressions
The named node expression proposal is a proposal made to extend the Turtle language in order to make certain Turtle expressions more compact and referenceable. It is an alternative that is intended to address several critical use cases currently under consideration by the RDF-Star Working Group. It should have no impact upon the underlying RDF.
An anonymous node is a node in a graph that is created via notational means (e.g., part of a brace expression "[]", linked list expression "()", reification expression "<<>>" or graph expression "{}"). Anonymous nodes are not directly referenceable even locally, and while they are usually rendered as blank node in RDF, in Turtle there is no way to explicitly name such nodes without losing the appropriate advantages of the notation.
A named blank node is a node in a graph that uses bnode notation to define a name that only has scope within a given Turtle file depiction of a graph, and that typically assigned as a bnode URI by the parser when the Turtle file is parsed. In this respect, named blank nodes are locally scoped. An anonymous node is not synonymous with a named blank node, though most anonymous nodes in Turtle are representable as blank nodes in RDF. An anonymous node is not referenceable at all within Turtle from outside the data structure, while a named blank node can be, so long as it is within the scope of a graph when encoded in Turtle.
A named node identifier is either a URI or blank node used by a named node expression to create a referenceable name for an anonymous node.
A named node expression is a mechanism in Turtle to assign a named node identifier to an anonymous node, where the name can be either a fully qualified IRI or a named blank node, when the Turtle is parsed.
## BNF Notation
<namedNodeExpression> ::= <op> <namedNode> "=>" <partialExpression> <endOp>
<op> ::= "[" | "(" | "<<" | "{"
<namedNode> ::= <iri> | <blankNode>
; :partialExpression is an expression dependent upon <op>, see below
<endOp> ::= "]" | ")" | ">>" | "}"
An expansion is a translation from a Turtle-star form to an RDF form, in which all anonymous nodes have either been named or assigned node identifiers by the system if un-named (the default behaviour in the absence of named node identifier).
An anonymous brace expression is an expression that creates an anonymous node as a blank node, then references this blank node in subsequent expressions.
A typical anonymous brace expression will look like the following:
Person:JaneDoe Person:hasName [ a Name: ; Name:firstName "Jane" ; Name:lastName "Doe"].
This anonymous expression has the following expansion form:
Person:JaneDoe Person:hasName _:a1234 .
_:a1234 a Name: .
_:a1234 Name:firstName "Jane" .
_:a1234 Name:lastName "Doe" .
where _:a1234 is a system-assigned blank node that represents an anonymous node.
A named brace expression is a brace expression in which the anonymous node is replaced with a named node identifier that can be referenced in subsequent expressions.
A *named brace expression resolves as a named node identifier that take the corresponding internal predicates and objects. For instance,
Person:JaneDoe Person:hasName [Name:JaneDoeBirthName => a Name: ; Name:firstName "Jane" ; Name:lastName "Doe" ].
This expands to the following RDF:
Person:JaneDoe Person:hasName Name:JaneDoeBirthName.
Name:JaneDoeBirthName a Name: .
Name:JaneDoeBirthName Name:firstName "Jane" .
Name:JaneDoeBirthName Name:lastName "Doe" .
where Name:JaneDoeBirthName is a named node identifier that is also an IRI.
Similarly,
Person:JaneDoe Person:hasName [_:JaneDoeBirthName => Name:firstName "Jane" ; Name:lastName "Doe" ; a Name: ].
resolves (expands) to
Person:JaneDoe Person:hasName _:JaneDoeBirthName .
_:JaneDoeBirthName Name:firstName "Jane" .
_:JaneDoeBirthName Name:lastName "Doe" .
_:JaneDoeBirthName a Name: .
where _:JaneDoeBirthName is a named node identifier that is also a blank node.
While the behavior of such named node expressions is the same, their effect are best shown if they are given as objects, predicates and subjects.
:s :p [:namedNode => :p1 :o1 ; :p2 o2 ; ...] .
This evaluates to
:s :p :namedNode .
:namedNode :p1 :o1 .
:namedNode ;p2 :o2 .
...
As given above, the following named brace expression can be written as follows:
Person:JaneDoe Person:hasName [Name:JaneDoeName => Name:firstName "Jane" ; Name:lastName "Doe"].
Name:JaneDoeName a Name; Entity:dateStart "1998-03-07" ; Entity:dateEnd "2021-11-05".
This creates a named node identifier Name:JaneDoeName
bound with the first name and last name. This is then referenced in another set of triples indicating a range. This expands to the RDF as:
Person:JaneDoe Person:hasName Name:JaneDoeName .
Name:JaneDoeName Name:firstName "Jane" ; Name:lastName "Doe".
Name:JaneDoeName a Name; Entity:dateStart "1998-03-07" ; Entity:dateEnd "2021-11-05".
[:namedNode => :p1 :o1 ; :p2 o2 ; ...] :p :o .
This evaluates to
:namedNode :p :o .
:namedNode :p1 :o1 .
:namedNode ;p2 :o2 .
...
Note: in the case of a subject replacement of a named node expression, this defaults to the expression:
:namedNode :p1 :o1 ; :p2 o2 ; ... ; :p :o .
:s [:namedNode => :p1 :o1 ; :p2 o2 ; ...] :o .
This evaluates to
:s :namedNode :o .
:namedNode :p1 :o1 .
:namedNode ;p2 :o2 .
...
Person:JaneDoe [_:hasBigCoIdentifier => rdfs:subPropertyOf Person:hasEmployeeIdentifier;
Identifier:hasAuthority Org:BigCo] "JD12345"^^xsd:string.
This expands to:
Person:JaneDoe _:hasBigCoIdentifier "JD12345"^^xsd:string .
_:hasBigCoIdentifier rdfs:subPropertyOf Person:hasEmployeeIdentifier .
_:hasBigCoIdentifier Identifier:hasAuthority Org:BigCo .
Note: This syntactical form makes it possible to define local properties, which moves Turtle-Star into alignment with OpenCypher Create Constructs. See the Use Cases section below for more details.
A named node expression can be composed within another named expression. For instance,
Actor:ElijahWood Actor:playedCharacter [ Character:Frodo => Character:inMovieSeries
[MovieSeries:LordOfTheRings => MovieSeries:directedBy Director:PeterJackson]].
This expands to the RDF:
Actor:ElijahWood Actor:playedCharacter Character:Frodo .
Character:Frodo Character:inMovieSeries MovieSeries:LordOfTheRings .
MovieSeries:LordOfTheRings MovieSeries:directedBy Director:PeterJackson .
Note: This notation is similar to OpenCypher CREATE notation.
Summary of the RDF-star WG wiki.
- Editor's guide
- Meeting minutes
- RDF terminology
- Scribes
- Use Cases collection
- RDF-star syntax and semantics:
- RDF-star "alternative baseline" (VOTED 2024.11.14 - frozen)
- RDF-star "liberal baseline" (current working version)
- RDF-star "minimal baseline" (VOTED 2024.07.18 - frozen - superseded by vote 2024.11.14 - deprecated)
- RDF-star "working baseline" (working version - deprecated)
- RDF‐star baseline examples
- RDF-star and LPGs
- Extending the baseline with "asserted" stuff
- systems and acronyms
- Task forces
- Text Direction considerations
- Text Direction Proposal
- Triple‐Edge-subgroup-proposals