Representation Of The NPCL Model

The NPCL data model is represented by a collection of interfaces as shown in the table below.

Table 12.1. Interfaces Representing the NPCL Model

Interface NameNotes
ISchemaRepresents an NPCL schema. Contains lists of all of the different types contained in the schema and provides index methods for finding types and constraints by several different criteria.
ISchemaItemThe base interface for all types and constraints in a schema. Provides methods for retrieving or modifying the extension values on a schema item.
ITypeThe base interface for all types in a schema. Derived from ISchemaItem, this interface adds support for getting/setting the display name and subject identifiers of a type and for getting/setting the Is Abstract Facet value.
IValueTypeThe base interface for types that support Value Facets. Derived from IType, this interface adds support for getting/setting the Datatype, Minimum Value, Maximum Value and Value Pattern Facets. Currently only the IOccurrenceType interface is dervied from this interface.
IAbstractTypeRepresents an Abstract Type in the schema - a topic that participates in the class hierarchy, but is not one of the concrete meta-types.
IAssociationTypeRepresents an Association Type in the schema. Derived from IType, this interface adds support for getting/creating/removing the Association Role Constraints that apply to the Association Type.
IOccurrenceTypeRepresents an Occurrence Type in the schema. This interface is dervied from the IValueType interface.
IRoleTypeRepresents a Role Type in the schema. This interface is dervied from the IType interface.
ITopicTypeRepresents a Topic Type in the schema. Derived from the IType interface, this interface adds support for getting/creating/removing the Occurence Constraints and Role Player Constraints that apply to the Topic Type.
IScopingTopicRepresents a Scoping Topic in the schema. This interface is derived from IType.
IConstraintThe base interface for representation of constraints in the schema. This interface is derived from ISchemaItem and adds support for getting/setting the Minimum Cardinality and Maximum Cardinality Facets.
IAssociationRoleConstraintRepresents an Association Role Constraint. Derived from IConstraint, this interface adds support for retrieving the Association Type and Role Type that participate in the constraint and for getting/setting the Arc Label Facet for the constraint.
IOccurrenceConstraintRepresents an Occurrence Constraint. Derived from IConstraint, this interface adds support for retrieving the Topic Type and Occurrence Type that participate in the constraint.
IRolePlayerConstraintRepresents a Role Player Constraint in the schema. This interface is dervied from IConstraint and adds support for retrieving the Association Type, Role Type and Topic Type that participate in the constraint.

To work with the API it is important to understand the containment hierarchy of the NPCL model - that is, which items in the model are "parents" that contain other items in the model. The containment hierarchy is quite simple and is shown in the UML diagram below - the black diamond indicates the "container" and the undecorated end indicates the "contained" item.

Figure 12.1. NPCL Containment Hierarchy

NPCL Containment Hierarchy

In addition to the interfaces that represent the schema model, the NetworkedPlanet.Npcl namespace provides classes for loading schema information from an XML file or from a topic map and for writing schema information to an XML file or topic map. In addition several convenience methods are provided in the class NetworkedPlanet.Npcl.SchemaUtils. These utility classes are described in more detail in the following chapter on using the API.