npcl : Topic Map Schema Utility

Command Synopsis
Usage Examples

The npcl command can be used to work with the NetworkedPlanet Constraint Language (NPCL). Using this tool you can:

  1. Export an NPCL schema from a topic map.

  2. Import an NPCL schema into a topic map, either updating or replacing existing schema information.

  3. Generate an NPCL schema by example, based on a topic map.

The npcl command works with NPCL schema files that use the NPCL XML syntax. You can read more about NPCL in the Engine API Guide document.

Command Synopsis

npcl [/host:<string>] [/database:<string>] [/userid:<string>] [/password:<string>] [/verbose] [/sibase:<base uri>] /action:{add|overwrite|export|generate} /mapname:<topic map name> /npcl:<filename>

Table 4. npcl Parameter Summary

Parameter (Short Form)

Description

/host (/h)

Specifies the name or IP address of the database server that hosts the TMCore system database.

Defaults to 'localhost'.

/database (/d)

Specifies the name of the database catalog that contains the TMCore system tables.

Defaults to 'topicmap'.

/userid (/u)

Specifies the database user ID to use when connecting to the database.

If this parameter is omitted, the connection will instead use the current Windows login for database authentication.

/password (/p)

Specifies the password to use when connection to the database.

This parameter is ignored if the /userid: parameter is not present. If the /userid: parameter is present and this parameter is omitted, the program will attempt to connect to the database using the specified user ID and no password.

/verbose (/v)

Give more verbose error messages.

/sibase (/si)

Used only for the generate action. This parameter specifies a base URI for generating subject identifiers for topics which do not currently have one but are required to do so to be included in the NPCL schema.

The generated subject identifier for a topic will be created by concatenating the display name for the topic (converted to lower case) with the base URI, with an additional numeric suffix if required to make the identifier unique.

If this option is omitted, the subject identifiers are instead generated in the form 'urn:x-tmcore:topicid:database id of topic', which will be recognised by the NPCL import process and will ensure that those topics are correctly updated with schema information.

If you are generating a schema that you wish to then import back into the same topic map, we recommend that you OMIT this option. If you are generating a schema that you want to use on other topic maps, we recommend that you SPECIFY this option.

/action (/a)

Specifies the action to be performed. This parameter is REQUIRED and must have one of the following values:

add

Specifies that the NPCL file should be imported into the topic map, adding to any existing schema information.

overwrite

Specifies that the NPCL file should be imported into the topic map, replacing all existing schema information.

export

Specifies that the schema information in the topic map should be written to the NPCL file.

generate

Specifies that the topic map should be processed to generate a schema based on the actual usage of types, scopes etc. in the topic map. The schema will be written to the specified NPCL file.

/mapname (/m)Specifies the name of the topic map to be read from or written to (depending on the action chosen).
/npcl (/n)Specifies the path to the NPCL XML file to be read from or written to (depending on the action chosen). On an export or generate action, if the file already exists, you will be prompted to confirm the overwriting of the file.

Usage Examples

npcl /a:export /m:mytopicmap.xtm /n:mytopicmap-schema.npcl

Exports the NPCL Schema information from the TMCore topic map named "mytopicmap.xtm" to a local NPCL XML file named mytopicmap-schema.npcl.

npcl /a:overwrite /m:mytopicmap.xtm /n:new-schema.npcl

Replaces the NPCL Schema information contained in the TMCore topic map named "mytopicmap.xtm" with the schema defined in the NPCL XML file named new-schema.npcl.

npcl /a:add /m:mytopicmap.xtm /n:new-schema.npcl

Adds the NPCL Schema information contained in the local NPCL XML file named new-schema.npcl to the schema information contained in the TMCore topic map named "mytopicmap.xtm".

npcl /a:generate /m:mytopicmap.xtm /n:mytopicmap-schema.npcl

Infers a new NPCL Schema based on the actual usage of types, scopes etc. in the TMCore topic map named "mytopicmap.xtm". The inferred schema is written to the local NPCL XML file named mytopicmap-schema.npcl. Topics in the source topic map which do not have subject identifiers but are required to do so by the restrictions of NPCL will have subject identifiers generated using the default form 'urn:x-tmcore:topicid:database id of topic'. This allows a subsequent import of the schema information into the same topic map (using the /a:add or /a:overwrite options) to locate and update those topics correctly.

npcl /a:generate /m:mytopicmap.xtm /n:mytopicmap-schema.npcl /si:http://www.example.com/psi/ontology/

Infers a new NPCL Schema based on the actual usage of types, scopes etc. in the TMCore topic map named "mytopicmap.xtm". The inferred schema is written to the local NPCL XML file named mytopicmap-schema.xml. Topics in the source topic map which do not have subject identifiers but are required to do so by the restrictions of NPCL will have subject identifiers generated using the custom subject identifier prefix 'http://www.example.com/psi/ontology/'. On a subsequent import of the schema information into the same topic map, the topics with these generated subject identifiers will be created as new topics and will not properly update the topics from which they were generated. This option is most useful when you want to generate a schema from one topic map and then import that schema into a different topic map or use it as the basis for creating a new topic map from scratch.