SWAG >> GMYSQL

Download GMYSQL

GMYSQL is a java program that translates arbitrary TA input into commands suitable for migrating this information content into a mysql database. This content can then be examined and manipulated using SQL. In addition to data migration this tool also generates some stored procedures that permit computation of recursive closure of edge sets, etc. since mysql does not yet support such actions within its current SQL data manipulation language.

Migration of gmysql to generate command suitable for other SQL database engines should be reasonably trivial.

The latest builds of GMYSQL are available below. While effort has been made to test GMYSQL, the software may contain bugs. Use at your own risk.

GMySQL 1.0.2 [gmysql-1.0.2.zip]
GMySQL 1.0.1 [gmysql-1.0.1.zip]

GMYSQL is being constantly developed and improved; check back often for newer versions.

Synopsis

gmysql [-d/rop] [-l/ists] [-t/iny [-t/able]] [-h/elp] <TAinput> [<prefix>] [<version>]

-d/rop emits appropriate drop table statements to avoid conflicts with existing instances of these tables.

-l/ists generates the schema_node_list_attributes, schema_edge_list_attributes, node_list_attributes and edge_list_attributes tables

-t/iny causes generation of new numeric node ids, and corresponding edges to be created between these new numeric node ids. This helps address issues where the length of node identifiers would otherwise cause storage and/or performance problems. If -t/ables is also specified then a mapping table from the newly generated numeric ids, back to the original ids is also populated. If this option is not specified then node identifiers are loaded as unchanged strings. The length for these strings is 255 characters unless some id has a string length X more than this. In this case the lengths are set to (X+2*1023)&~1023.

If a prefix is specified all tables are created with this specified prefix. This permits tables to be located in a specific schema, and/or to have their names suitably prefixed (to support versioning etc).

If version is specified all tables are created with an additional version column, and the provided version information is inserted into this new column. This permits (if desired) data from multiple versions of extracted TA to be inserted into common tables.

Generated schema tables

The following schema tables may be generated by GMYSQL.

schema_node_inherits

create table schema_node_inherits (
    class      varchar(255) not null,
    superclass varchar(255) not null,
    index using btree (class, superclass),
    index using btree (superclass)
)
default character set utf8
ENGINE=Innodb;

Identifies the set of superclasses that a node class inherits from. In addition to suggesting an 'is a' relationship, node classes inherit the attributes of their direct and indirect superclasses. Node classes not explicitly identified in the TA as having a superclass inherit within this table from $ENTITY.

schema_edge_inherits

create table schema_edge_inherits (
    class      varchar(255) not null,
    superclass varchar(255) not null,
    index using btree (class, superclass),
    index using btree (superclass)
)
default character set utf8
ENGINE=Innodb;

Identifies the set of superclasses that an edge class inherits from. In addition to suggesting an 'is a' relationship, edge classes inherit the attributes of their direct and indirect superclasses. Edge classes not explicitly identified in the TA as having a superclass inherit within this table from $RELATION.

schema_edge_connects

create table schema_edge_inherits (
    class        varchar(255) not null,
    start_class  varchar(255) not null,
    end_class    varchar(255) not null,
    index btree (class,start,end),
    index btree (start,end)
    index btree (end)
)
default character set utf8
ENGINE=Innodb;

Identifies the legitimate start and end node classes a given relation class may target. This relation is informative, and may or may not be consistent with the other tables present in the TA.

schema_node_attributes

create table schema_node_attributes (
    class     varchar(255) not null,
    attribute varchar(255) not null,
    value     varchar(10000),
    index btree (class,attribute)
)
default character set utf8
ENGINE=Innodb;

Identifies the legitimate attributes of a given node class and their default values. This relationship is informative and may not be consistent with the other tables present in the TA.

schema_edge_attributes

create table schema_edge_attributes (
    class     varchar(255) not null,
    attribute varchar(255) not null,
    value     varchar(10000),
    index btree (class,attribute)
)
default character set utf8
ENGINE=Innodb;

Identifies the legitimate attributes of a given edge class and their default values. This relationship is informative and may not be consistent with other tables present in the TA.

Optional schema tables

These two tables are only generated if the -l/ist option is specified.

schema_node_list_attributes

create table schema_node_list_attributes (
    class     varchar(255) not null,
    attribute varchar(255) not null,
    pos       int unsigned not null
    value     varchar(10000),
    index btree (class,attribute)
)
default character set utf8
ENGINE=Innodb;

Provides a breakdown of node attribute list values by individual item within this list. The first list item has pos 1, etc. Node attribute values that are not themselves lists are not reflected in this table.

schema_edge_list_attributes

create table schema_edge_attributes (
    class     varchar(255) not null,
    attribute varchar(255) not null,
    pos       int unsigned not null,
    value     varchar(10000),
    index btree (class,attribute)
)
default character set utf8
ENGINE=Innodb;

Provides a breakdown of edge attribute list values by individual item within this list. The first list item has pos 1, etc. Edge attribute values that are not themselves lists are not reflected in this table.

Generated data tables

The following data tables may be generated by GMYSQL.

nodes

create table nodes (
    id        varchar(255) not null,
    class     varchar(255) not null
    index using btree (id),
    index using btree (class)
)
default character set utf8
ENGINE=Innodb;

Identified the nodes in the graph and their class. Those nodes not given a class in the TA (instead only being assigned attributes) are explictly associated with the $ENTITY class.

edges

create table edges (
    class     varchar(255) not null,
    start     varchar(255) not null,
    end       varchar(255) not null,
    index btree (start,end,class),
    index btree (end,class),
    index_btree (class)
)
default character set utf8
ENGINE=Innodb;
Identified the edges between nodes in the graph and their class. Such edges in the TA may be specified explicitly, or implied consequence of having attributes.

node_attributes

create table node_attributes (
    id        varchar(255) not null,
    attribute varchar(255) not null,
    value     varchar(10000),
    index btree (id, attribute)
)
default character set utf8
ENGINE=Innodb;

Specifies the attributes associated with a node having a given id and when present this attributes value.

edge_attributes

create table node_attributes (
    class     varchar(255) not null,
    start     varchar(255) not null,
    end       varchar(255) not null,
    attribute varchar(255) not null,
    value     varchar(10000),
    index btree (start, end, class)
    index btree (end, class)
)
default character set utf8
ENGINE=Innodb;

Specifies the attributes and when present the attribute value associated with an edge of a given class connecting a start and end node identified by a node id.

Optional data tables

These tables are only generated if the -l/ist option is specified.

node_list_attributes

create table node_attributes (
    id        varchar(255) not null,
    attribute varchar(255) not null,
    pos       int unsigned not null,
    value     varchar(10000),
    index btree (id, attribute)
)
default character set utf8
ENGINE=Innodb;

For list valued attributes associated with nodes identifies the individual elements of this list's values.

edge_list_attributes

create table node_attributes (
    class     varchar(255) not null,
    start     varchar(255) not null,
    end       varchar(255) not null,
    attribute varchar(255) not null,
    pos       int unsigned not null,
    value     varchar(10000),
    index btree (start, end, class)
    index btree (end, class)
)
default character set utf8
ENGINE=Innodb;

For list valued attributes associated with edges identifies the individual elements of this list's values.

Stored procedures

compute_paths(seed, target, rule)

Constructs when called a new table called target that initially is assigned the start and end direct edge relationships of the seed table. The transitive closure of all start->end edges in this target table are then added to this target table. The rule may either be an empty string, or a where clause used to further restrict the rows that may be added during the computation of transitive closure.

E.g. call compute_paths('edges','paths','');.

compute_pathsteps(seed, target, rule)

Behaves identically to compute_paths but adds an additional column to the output target table specifying the minimum number of edges that must be traversed to construct a reported path. With some caveats, the optional rule may then be used to limit maximum path lengths, etc.

E.g. call compute_pathsteps('(select start,end from edges where class = \'contain\')','closely_contained', 'where steps < 3');

compute_schema_all_node_attributes()

Recursively computes a derived schema_all_node_attributes table when called which extends the schema_node_attributes table, by also including attributes inherited directly or indirectly from superclasses. This computed table contains one additional superclass column that when not null indicates the nearest node superclass from which an attribute is inherited.

E.g. call compute_schema_all_node_attributes();

compute_schema_all_edge_attributes()

Recursively computes a derived schema_all_edge_attributes table when called which extends the schema_edge_attributes table, by also including attributes inherited directly or indirectly from superclasses. This computed table contains one additional superclass column that when not null indicates the nearest edge superclass from which an attribute is inherited.

E.g. call compute_schema_all_edge_attributes();

Developed by

  • Ian Davis.

Supported platforms

Any JAVA platform

Contact information

For more information on GMYSQL please contact us at .