Defining Resource Templates

When you open a data model in the Model editor, there is a Resource Template setting for each of the classes in the model. A Resource Template defines the Uniform Resource Identifier (URI) pattern that Anzo should follow when ingesting data and generating the URIs for the instances of each class. Defining a Resource Template for the classes in your models helps link and relate data by using URI patterns that express the meaning of the data and combine similar concepts. Additionally, simpler and more meaningful URIs are easier to read and therefore easier to write in queries.

Keep the following points in mind when defining class instance URI patterns:

  • Do not modify auto-generated, layer-managed models. Changes will be overwritten whenever the host graphmart or layer is reloaded or refreshed. For more information, see Managed Model Concepts.
  • Avoid joining data that should not be joined. For example, using a property such as YearProduced in a movies Resource Template would group all movies from a given year as a single instance.
  • Resource Templates with multiple components must have all components present. If a component is missing, Anzo generates random strings for missing Resource Template components.
  • Resource templates do not work across different classes. You must define resource templates on individual classes.

For property URIs, the default URI prefix is http://cambridgesemantics.com/. The value is controlled by the URI Prefix option in server settings. See Configure the URI Prefix and SPARQL Endpoint for more information.

  1. In the Anzo application, click Model. Anzo displays the Manage Data Model Working Set screen. For example:

  2. On the Manage Working Set screen, select the checkbox next to the model (or models) that you want to add to the working set for editing. Then click OK. Anzo opens the selected model in the editor. For example:

  3. Click the Details tab.
  4. Select a class in the model to display the settings for that class. Then scroll down to the Resource Template field. For example, the image below shows the Resource Template field for the selected Movie Actors class.

  5. Click the Resource Template field and specify the URI pattern to use for instances of this class. First, type a base value in the field and press Enter to add the value to the field. For example, for Movie Actors in the step above: http://cambridgesemantics.com/Movie/Actor.

    Then click the field again and select a property in the class that defines the class, i.e., contains unique values. For example, in the Movie Actors class, Actor ID provides unique values.

  6. Click Save to save the change, and then select another class for which to set a Resource Template. Repeat the step above for each class in the model.