The Ring application (to be understood as "Ring of knowledge") allows to draw relations between wiki pages. For instance, the relation has author can be created to state that page The Jungle Book has relation has author with page Rudyard Kipling. Relations are stored in the wiki as any other page, with the only specificity that they have relation is a with the page Relation. Each page connections can be browsed using a widget showing up under their title, allowing also to add new connections.

The application allows to:

  • Create types and relations as wiki pages
  • Use these relations to interlink pages with one another, hence creating "rings": ring join a page, a relation and another page and can have internal properties (work in progress)
  • Explore pages via their relations, using facets
  • Define relations constraints and properties

A ring is an ordered set consisting of:

  • An origin page
  • A relation
  • A destination page or a scalar value (string, date, number, etc.)
  • A set of properties

For example, The Jungle Book has author Rudyard Kipling or The Jungle Book has publication date 1894 are rings.

Relations can have specific constraints, such as a constraint about the pages they can bind to one another. For instance, the relation has author will typically accept as destination pages only those of type person or organization. A page type is defined by linking it to the built-in Type page via relation is a, built-in as well. For example: Book is a Type.


Representation of a graph. Source:

User interface

Once installed, the application adds a block to each page header which displays the list of pages that are linked with the current one. This list can be ordered by page title or by last modification date.

This additional block also includes crosses for removing existing connections, and a button for adding new ones. When hitting this button, a form shows up, displaying the list of relations that the current page can use, and a search input field for selecting a destination page. For instance, on page The Jungle Book, once declared as a book, the form will typically propose the relations has author, has publication date, has publisher, etc. When selecting the relation has author, the search input field will suggest all the wiki pages of type person that match the entered input. The form supports only the addition of edges linking two pages together, not yet a page and a scalar value.

The user interface also includes a Filter buton which makes it possible to restrict the list of related pages by their own types or relations. All relations available in the wiki are automatically added to the faceting system for easy navigation across the graph of pages.

In order to draw a relation between two pages, the user needs to have at least edit right on the origin page. On a given page, a user will see all the related pages even whatever his access rights on them: in case he has no view access on a given connected page, he will get a denied access only when trying the view the content of that page.


Page "The Jungle Book" and its related pages


Form for connecting pages

Example: Nobel Prize laureates

The application includes a Wikidata data importer which creates a set of relations and types corresponding to Nobel Prizes Laureates data – in particular the relations has award, has country, and the types person and organization – and import data into the wiki.

Wikidata is a project that stores data using a graph structure as well, and provides interfaces for browsing the graph visually and for entering new statements.

Once imported into the wiki, the Nobel Prize laureate pages can be browsed using facets. For instance, all organizations and persons who received the Nobel Peace Prize can be browsed by country.


Facet filtering on page "Person"

Data model

TermA Term simply wraps a wiki page. It can have inward and outward rings.
RingA a ring typically links together two vertices – an origin and a destination – and a relation. The Jungle Book has author Rudyard Kipling is an ring that has referent page The Jungle Book, related page Rudyard Kipling, and relation has author. A ring can be a vertex, so that it's also possible to create rings involving rings, such as: Anna says that "The Jungle Book has author Rudyard Kipling", where says is a relation used by the edge having origin Anna and destination The Jungle Book has author Rudyard Kipling.
RelationA relation has a domain and an image. Its domain is the set of terms on which it can be applied to, and its domain is the set of terms it can accept as values. For instance, has award is a relation. Its domain is the set of pages representing a person or an organization. Its image is the set of pages that represent an award.
RingSetA RingSet is a set of terms, rings and relations.


Ring application class diagram

Built-in relations

The application includes a set of predefined relations described below, and one type.

Relation or TypeDescriptionExample
Is connected toCan be used to express that two pages are related to one another.The Jungle Book is connected to Rikki-Tikki-Tavi.
Is aCan be used to declare that a page has a specific type.Rudyard Kipling is a journalist.
Is transitiveCan be used to specify whether a relation is transitive or not.Relation is a is transitive: if Rudyard Kipling is a journalist, and journalist is a person, then Rudyard Kipling is a person. This property is not used by the application at the moment.
Has domainCan be used to specify the set of pages a relation can take as first parameter. It is similar to the RDF schema domain property, except that rdfs:domain only accept class names, while the has domain relation can accept any set definition. Relation has head office has domain organization.
Has imageCan be used to specify the set of pages a relation can have as destination. It is similar to the RDF schema range property. The terms domain and image come from the mathematical definition of a relation.Relation has author has image person.
TypeRepresents a type.The page Type has relation is a with itself: a type is a type. Book is a type.


Visual representation of an example set of terms, relations and rings. Rings are circles connecting an origin, a relation and a destination.

Script service

The application includes a script service that can be accessed via $services.graph and which exposes the functions below.

  • void addRing(DocumentReference origin, DocumentReference relation, DocumentReference destination)
  • List<XWikiRelation> getRelations(DocumentReference vertex)
  • List<DocumentReference> getDirectPredecessors(DocumentReference vertex, DocumentReference relation)
  • String getDomain(DocumentReference relation)
  • String getImage(DocumentReference relation)
  • List<XWikiRelation> getRelations()
  • removeRing(DocumentReference origin, DocumentReference relation, DocumentReference destination)
  • List<DocumentReference> search(String text)
  • List<DocumentReference> search(String text, DocumentReference relation)


The application hinges on the XWiki classes below.

XWiki classProperties
  • has-relation: page
  • has-relatum: page
  • has-relation: page
  • has-value: large string
  • has-relation: page
  • has-value: date
  • has-relation: page
  • has-value: boolean

An additional index field is added automatically by Solr when indexing Ring objects, via a SolrMetadaExtractor component having a higher priority than the default one provided by xwiki-platform. For instance, "The Jungle Book has author Rudyard Kipling" is indexed as follows in Solr:

property.ring.Graph.HasAuthor_string:[Ring.Rudyard Kipling].

In addition, all converse rings are indexed, but only partially at this stage, using the generic relation is connected to, because inverse relations are not handled at this stage, so that we have, for page wiki.Rudyard Kipling the following index entry:

property.ring.Ring.IsConnectedTo_string:[Ring.The Jungle Book].

The implementation consists in particular of the following components:

  • XWikiRing: allows to create terms, relations and rings
  • SolrRingIndexer: manages the index of rings
  • SolrRingTraverser: runs queries across terms, rings and relations


Next steps

  • Ability to add ring scalar values via a form.
  • See if the default EmbeddedSolrInstance can expose a method for accessing an indexed SolrDocument by its id.
  • Support relation transitivity.
  • Associate types with XWiki sheets.
  • Store the graph in a graph database.
  • Create rings using wiki syntax or macros: {{ring relation="wiki.HasAuthor" destination="wiki.Rudyard Kipling"}}The author of this book is Rudyard Kipling.{{/ring}}
  • Handle inverse relations. For example the inverse of relation "has author" is relation "has authored".
  • Display pages in livetables with ability to filter them by their rings.

Application name

The application is at the crossroads of semantics (sentences connecting words), logic (binary relations) and mathematics (graphs). The core structure on which it builds on relates a term to another one using a given relation. So far, the vocabulary of logic and mathematics is used by the application: the first term is named a referent, and the one it relates to is named a relatum. The words term and relation are used in reference to logic, mathematics and daily language.

It seems that there is no specific term used in logic or mathematics for describing a structure consisting of a referent, a relation and a relatum, with the capability to encompass more terms potentially, via n-ary relations where n is greater than 2. Logic has the word sentence but it's more specific, it seems. RDF uses the term statement to describe triples of resources, but this term clashes with the day-to-day usage of the word statement (for instance I am is a statement, but it does not involve a relatum), and also because in the future, the structure at stake could relate more than three terms together. The structure currently used actually already involves more than three terms, since it can have an optional set of properties, in order to describe further the connection between the three terms: properties can be seen as a handy shortcut for adding metadata about a node, just like what property graphs do, even though, in principle that would be more satisfying to represent them using a common unified structure: each property can be seen as a referent, relation, relatum as well, but it introduces some implementation complexity.

So far, the word ring has been chosen to represent the core structure, mostly because it corresponds well to a visual representation (however visually the circle should not be closed, since the ring can be navigated only in a given direction), it catches well the semantics of tying several terms together, and it has a fractal nature: it's easy to imagine a ring connecting several rings. In addition, it's short, it sounds well, it's contained in the word string, letting us draw connections with strings in litterature, circus and physics. Any other term catching better this structure is welcome. Other options have been considered, such as edge, hyperedge, node,... The higher-level structure consisting of a set of rings corresponds to an hypergraph, since each edge ties together several terms. It's currently a uniform 4-hypergraph since all edges have four vertices (referent, relation, relatum, properties), even though some are allowed to be empty (e.g. properties). The relatum term can either have an identifier or be a scalar (e.g. a given date or number). Each edge is also a vertex, so that edges can be involved in other edges.

Related projects


Graphs and hypergraphs

The data structure of the application is an hypergraph.


Created by slauriere on 2019/09/25 08:17

Get Connected