Types

Every topic map consists of a set of topics, occurrences, associations and association roles. The Topic Maps model allows all of these constructs to be assigned a type. NPCL allows you to specify what types are present in your topic map, and what constructs each type can be used on. For example, it would allow you to say that the topic "Person" can be used as the type of other topics, but not as the type of an occurrence or association.

Types are specified by defining which meta-type they belong to. The meta-type is simply the topic map construct that the type can be applied to. NPCL defines the following 4 meta-types:

Topic Type - types belonging to this meta-type can be used as the type of topics in the topic map.
Occurrence Type - types belonging to this meta-type can be used as the type of occurrence in the topic map.
Association Type - types belonging to this meta-type can be used as the type of associations in the topic map.
Role Type - types belonging to this meta-type can be used as the type of association roles in the topic map.

Any type can belong to more than one meta-type. It is allowed, for example to say that the topic "Website" is both a Topic Type and an Occurrence Type.

Type Facets

Some of the meta-types allow type definitions to carry additional information in the form of facets. Facets are simply string properties with a special pre-defined meaning.

The following sections describe the facets defined by NPCL and how they are used.

Is Abstract Facet

This facet is found on Topic Types, Occurrence Types, Association Types and Role Types. Its value is a simple boolean string (either "true" or "false"). If the value is "true", this indicates that the type cannot be instantiated - that is that the user should be prevented from creating a topic, occurrence, association or role of that type. Although users cannot create instances of types marked as abstract, these types can still be used in the definition of constraints and these constraint definitions are then inherited by subclasses, which may be instantiated by users.

For example we may define an "Employment" association. We want to say that the "Employer" role can be played by either a "Person" or a "Company". Both "Person" and "Company" derive from a common superclass "Legal Entity". We can specify that "Legal Entity" is a Topic Type and then use it to define a Role Player Constraint that says that topics of type "Legal Entity" can play the role "Employer". However to force users to create topics that are either instances of "Person" or "Company" and to prevent them from creating topics of type "Legal Entity", we can add the Is Abstract facet to the type

Scoping Facet

This facet is found on Topic Types. It defines how instances of the Topic Type can be used in scoping other constructs in the topic map. Topics can be used to define the scope of topic names, occurrences or associations. By applying this facet to a Topic Type, you can specify that instances of the Topic Type can be used only to scope one of these constructs or any combination of them.

The string value of this facet should be one or more of the following strings (separated by spaces, tabs or carriage returns if you specify more than one).

NAME

Indicates that topics of this type can be used to scope topic names.

OCCURRENCE

Indicates that topics of this type can be used to scope occurrence on topics.

ASSOCIATION

Indicates that topics of this type can be used to scope associations between topics.

For example, you may create a Topic Type "Language", the instances of this Topic Type would be topics such as "English", "French", "Klingon" and so on. It makes sense to allow the use of these topics to scope names and occurrences, but not much sense to allow them to scope associations as associations between topics are (almost always) language-independent. To specify this rule in NPCL, you simply add a Scoping Facet to the "Language" Topic Type with the value "NAME OCCURRENCE" (or "OCCURRENCE NAME" - the ordering is irrelevant).

By default, if no value is provided for the Scoping Facet of a Topic Type, it is assumed that instances of the Topic Type should not be used for scoping.

Value Datatype Facet

This facet is allowed on Occurrence Types. It defines the datatype of the value of any occurrence typed by the Occurrence Type. A datatype is simply the kind of value that is allowed on the occurrence - for example a "Date Of Birth" Occurrence Type might only allow values that are of a "date" datatype.

NPCL does not pre-define a set of datatypes. This is deliberate, as different applications and different topic map ontologies will have different requirements with regards to datatypes. However we recommend that unless you have unusual datatyping requirements, you should use the set of URI identifiers for datatypes that are defined by Part 2 of the W3C XML Schema specification (as noted in the schema for XML Schema Datatypes, the URI Identifier for a data type is simply the URI of the XML Schema namespace, followed by a fragment identifier which is the name of the datatype - e.g. http://www.w3.org/2001/XMLSchema#int.

Minimum Value and Maximum Value Facets

These facets are allowed on Occurrence Types and are used to specify the lower and upper bound on the range of acceptable values for occurrences typed by the Occurrence Type. For example a "Batting Average" Occurrence Type might be given a Minimum Value facet of "0.0" and a Maximum Value of "1.0".

Value Pattern Facet

The Value Pattern facet is allowed on Occurrence Types and is used to specify a regular expression that defines the acceptable values for occurrences typed by the Occurrence Type. The regular expression should follow the syntax defined in Appendix F of Part 2 of the W3C XML Schema specification .

For example an occurrence of the Occurrence Type "Price" could be restricted to one or more digits followed by a decimal point and two further digits by setting the Value Pattern Facet for the "Price" Occurrence Type to "(\d)+.\d\d".