Transferable Graph
Revision as of 12:46, 28 September 2010 by Toni Kalajainen (talk | contribs) (Created page with 'Transferable Graph (.tg) is a graph / statement container file. ==Format== The format is defined as a binary serialization of the following datatype: union TransferableGraph =...')
Transferable Graph (.tg) is a graph / statement container file.
Format
The format is defined as a binary serialization of the following datatype:
union TransferableGraph = TransferableGraph1 type TransferableGraph1 = { resourceCount : Integer, indentities : Identity[], statements : Integer[], values : Value[] } type Identity { resource : Integer, definition : IdentityDefinition } type IdentityDefinition = | Root { name : String, type : String } | External { parent : Resource, name : String } | Optional { parent : Resource, name : String } | Internal { parent : Resource, name : String } type Value = { resource : Integer, value : Byte[] }
Each resource in a transferable graph is referred with a 32-bit integer beginning with zero.
- resourceCount
- Tells how many resources are used in the file. Some resources may already exist in the database, some will be new.
- identities
- Tells how to find the resources that should already exist in the database. Also the new resources with URI are given an identity so that it easier to refer to them when the graphs are compiled separately. The identities have to be ordered so that if the identity refers to another resource, its identity is already given.
Root
defines a resource as a root. Ifname
is "", the resource is the root library of the database. Other roots are interpreted in application specific ways.External
tells that a resource is a child of some other resource and should already exist in the database.Optional
tells that a resource is a child of some other resource. It may exist or not exist already in the database. In the latter case, it is created.Internal
tells that a resource is a child of some other resource. It may not yet exist in the database for the import to be successful.
- statements
- Contains all new statements that the transferable graph defines. The length of the array is 4*resourceCount. The array has for every statement its subject, predicate, inverse of the predicate and object in this order. If the statement does not have an inverse (that is different from itself), the inverse is -1.
- values
- Assigns values to all literals in the transferable graph.