Skip to content

Latest commit

 

History

History
95 lines (64 loc) · 3.67 KB

transclusion.md

File metadata and controls

95 lines (64 loc) · 3.67 KB

Nesting Graphs via Transclusion

Transclusion is the mechanism driving graph nesting. It imports the statements from a graph into the including graph. In that way it is very similar to owl:imports.

Transclusion is transitive: if the transcluded graph contains further transclusion directives, those are executed (i.e. transcluded) as well. A TriG example without extra syntactic support illustrates its application:

:NG_2 nng:transcludes :NG_1 .
:NG_1 { :a :b :c }
:NG_2 { :d :e :f }

The location of the transclusion statement does matter. In the preceding example the transclusion directive is not visible, and therefore not executed, when inspecting :NG_2 in isolation.
In the following example :NG_2 always transcludes :NG_1:

:NG_1 { :a :b :c }
:NG_2 { 
    :d :e :f . 
    :NG_2 nng:transcludes :NG_1 . 
}

Syntactic Sugar

Explicitly stating a transclusion via an nng:transcludes relation is not necessary when the NNG syntax is used, like in the following example:

:NG_2 { 
    :d :e :f . 
    :NG_1 { :a :b :c }
}

Inheritance of Annotations

Transclusion doesn't mean that annotations are inherited, neither on terms, triples or graphs. The one exception is the nng:tree fragment identifier: annotations using nng:tree annotate the graph and all transcluded graphs.

Circular Transclusion

Transclusion relations are not allowed to create circular references. That can't happen in the NNG syntax, but when using explicit nesting statements.

Transclusion vs Inclusion vs owl:imports

The differences to the inclusion mechanism is that

  • inclusion is defined on graph literals, whereas transclusion is defined on graph sources, and
  • inclusion is not transitive, but transclusion is.

The difference to owl:imports is that the latter only imports the statements from a graph, whereas transclusion imports the whole graph.

TODO

owl:imports only imports the statements that a graph contains inclusion and transclusion however import (named) graphs as a whole, not only the statements they contain (and nest them inside other graphs) that needs to be made very clear

also the difference between the following three idioms has to be clarified:

  • just annotating a graph via reference to its name,
  • transcluding it via an explicit statement to that effect and
  • defining and transcluding and maybe even annotating it in one stroke via syntactic sugar
  • and then we also need to discuss the meaning of nesting, what it means for one graph to be nested inside another graph

Vocabulary

The nng:transcludes property is defined as:

# VOCABULARY

nng:transcludes a rdf:Property,
    rdfs:subPropertyOf owl:imports ;
    rdfs:domain nng:NamedGraph ;
    rdfs:range nng:NestedGraph ;
    rdfs:comment "Includes a graph source into another graph source. Transclusion is transitive: if the transcluded source contains further transclusion directives, those are executed as well." .

Note that the nesting graph is of type nng:NamedGraph, meaning that its semantics are not specified. This is meant to ensure backwards compatibility with RDF 1.1 named graphs.