Skip to content

Language and linking basics

Alexander Nittka edited this page Feb 25, 2015 · 4 revisions

Xtext is a framework simplifying the creation of domain specific languages and the necessary infrastructure. Two of the core concepts that allow out-of-the-box support are named elements (the definition of an object) and references (to an object). A named element can be referenced via its name, a reference points to one named element. Usually in a language there is some syntactic distinction between the definition and the reference (think of class definitions or variable declarations vs. their uses elsewhere). When starting on a new language without predefined and fixed underlying model structure, one decides which elements should be valid targets of a reference.

The basic challenge of the Turtle language (and any RDF representation for that matter) is the following. In a subject-predicate-object triple, every element is both definition and reference; there is no semantic, let alone syntactic, distinction. Further, name and object are the same thing, i.e. the same name in different files is the same object. This is different from how Xtext works. There, any two objects have distinct URIs, they may have the same name, though. References point to exactly one object (via its URI calculated in the linking process from the object name and additional scoping/visibility information).

#Our approach We consider each subject to be the definition, predicates and objects are references. That is, subjects are linked to, predicates and objects link to a subject. Each file should contain the subject only once. However, the same subject may appear in different files. The (Xtext) qualified name always has two parts calculated from the fully resolved URI: the simple name (URI fragment or last segment if there is no fragment) and the rest. There are no namespace or implicit imports. This is the basis for all (hyper)linking processes. For each subject, predicate and object we calculate the fully resolved URI and the corresponding qualified name which allows us to relate them to each other.

In order to reuse as much of the Xtext infrastructure as possible, we use a brute force approach to "Find References". The index does not only contain an entry for an actual link (e.g. predicate P1 to object O1), but an entry for every other object with the same URI as O1. That is, the index reflects the RDF graph to a certain extend. Yes, this approach will not scale.

Clone this wiki locally