Automatic transformation of XML namespaces/RDF grammar trees

From Wikiversity
Jump to: navigation, search

The below describes grammar and meaning of an RDF file, as it should be used in our software.

After reading an RDF file, some information (namespaces, transformations, etc.) is extracted from it, as the RDF file is considered as an instance of the below defined grammar.

Remark: The below grammar always applies to one RDF file, it never applies to several RDF files merged.

Rationale: If the data were merged on loading every new RDF file, this would possibly create contradictory (not conforming to the grammar described below) information when loading the next RDF file.

Cardinality of a predicate P for a subject S is the number of objects for these predicate and subject. We will denote cardinalities as:

  • 0..1 (a number equal to 0 or 1)
  • 1..1 (exactly 1)
  • 0..* (any natural number)
  • 1..* (any positive natural number)

It should be specified the set of all RDF grammar trees (grammar forest).

For each RDF node for which it is stated that it belongs to a root object, we will require that certain predicates on this node have certain cardinality, that nodes of certain objects of these nodes have certain cardinality, etc.

I will denote this as a tree: The root node is a class IRI. The rest nodes are interleaving predicates together with cardinalities and nodes.

I will write additional requirements for a node in parentheses. Specifically if a node must be of an XML Scheme datatype, I will write the type in brackets.

I will call such trees format trees.

Note that subjects may have additional predicates not described in the format trees. For example (below) objects of class :Namespace may have predicates :link.

A node X for which it's specified in the RDF file that it is of class ROOT ("X a ROOT"), where ROOT is the root of a grammar tree in the forest, is conforms to the grammar, if the triples starting at the subject X conform to the cardinality constrains and so it is recursively for the subtrees. Furthermore, it is valid if it also conforms to additional validity constrains.

An RDF file conforms to grammar tree if for every node X of this file, such that "X a ROOT" where ROOT is the root of the grammar tree, conforms to the grammar.

An RDF file conforms to grammar forest if and only if it conforms to every grammar tree in the grammar forest.

RDF file is valid (for the purposes of this specification) if it conforms to grammar forest and all additional validity constraints defined in this specification.

See below for examples.

Extracted RDF data will be named in this specification as indicated by italicized text in parentheses.