Defining Schema Constants

Top  Previous  Next

This is not a required step, but it is considered best practice. When working with topic maps and schemas you will quickly find that URI identifiers are extremely important. For this reason we recommend that rather than retyping full URIs everywhere that they are needed in method calls you instead create a single list of constants. This approach saves a lot of repeated typing and the possibility of typing mistakes causing difficult to track down problems. At the very least your constants file should include all the identifiers for the types in your schema, but it could also be used to hold identifiers for key topics in the topic map (e.g. the URI identifiers assigned to hierarchies for example).

 

   internal class SchemaConstants

   {

      public const string SchemaBase = "http://www.networkedplanet.com/business-ontology/types/";

      public const string Person = SchemaBase + "person";

      public const string Product = SchemaBase + "product";

      public const string Company = SchemaBase + "company";

      public const string WorksFor = SchemaBase + "worksFor";

      public const string Employer = SchemaBase + "employer";

      public const string Employee = SchemaBase + "employee";

      public const string Manages = SchemaBase + "manages";

      public const string Manager = SchemaBase + "manager";

      public const string Minion = SchemaBase + "minion";

      public const string FriendOf = SchemaBase + "friendOf";

      public const string Friend = SchemaBase + "friend";

      public const string Age = SchemaBase + "age";

      public const string Weight = SchemaBase + "weight";

      public const string Description = SchemaBase + "description";

   }