Dealing with Missing Attributes or Types

From OSF Wiki
Jump to: navigation, search


If you are using OSF Import to import a dataset and its option "Check for missing attributes and types in the imported dataset." is enabled, or if your import script supports that functionality, then each time you import a new dataset, the system will tell you which attributes or types used in the dataset are missing in the ontology(ies) structure currently used by the Open Semantic Framework instance.

A missing attribute or type will not cause a OSF Web Service import to fail. However, it is important to take corrective action for those missing attributes or types so noted.

This documentation page tells you what you should do when such attributes or types are detected, and why.

Missing Attribute or Type Detected

If during import you receive the warning message that an attribute or type is missing, now what? The message means that there is at least one record in your system for which the system has no knowledge of a given attribute or type. Though the dataset will successfully import (absent other problems), the warning has important meanings.

If an attribute is missing, it means that:

  1. No user interface will know what words to use to refer to that attribute when it gets displayed to the user. The user interface will generally hack a label from its URI reference
  2. No domain and no ranges for that attribute will be defined. This means that the default domain and range for that undefined attribute will be owl:Thing, which means that different systems will be able to use it to describe anything (think of an attribute foo:hasSixLegs used to describe a foaf:Person record). This may have bad side effects and create weird results.

If a type is missing, it means that:

  1. No user interface will know what words to use to refer to that attribute, when it gets displayed to the user. The user interface will generally hack a label from its URI reference
  2. No types will be inferred by the system when the record is created.

Thus, the first goal is to create the missing attribute or type in one of the ontologies used by the system.

Create the Missing Attribute or Type

The missing attribute or type can be added to an existing ontology currently used by the system, or it can be added to a new ontology that will be imported.

Adding in an Existing Ontology

If you want to add the attribute or type to an existing ontology, you have two possibilities:

  1. You add it to the existing ontology using the OSF Ontology ontology management tool. Here is a list of documents to help you create such an attribute or such a type:
    1. Using OSF Ontology
    2. Ontology Development Methodologies
  2. You add it to the existing ontology by manipulating the OWL file of that ontology using a text editor, or another ontology editor such as Protégé. Here is a list of documents to help you create such an attribute or such a type:
    1. Protégé Manual
    2. Protégé Editing Tips

If you are unsure about which possibility to use, you can refer to the OSF Ontology v Protégé? manual to be aware of the two different tools.

Adding in a New Ontology

The other possibility is to create a new ontology and to import it into the system using OSF Ontology. You can create the new ontology using Protégé or any similar ontologies management tools.

The next step is to re-generate the derivative knowledge structures used by different parts of the Open Semantic Framework.

Update Derivative Structures

In an Open Semantic Framework instance, all of the loaded ontologies are collectively referred to as the ontologies structure. This knowledge structure is what is used to describe the records created in the system and what is used to instruct some part of the system about how to behave relative to different kind of records.

This ontologies structure is also used to generate a series of derivative knowledge structures serialized in different formats. Here is the current list of all the generated structures from the loaded ontologies:

  1. The internal PHP array classHierarchySerialized.srz and propertyHierarchySerialized.srz structures. These structures are used by OSF Web Service and OSF-Drupal
  2. The irON XML Schema used by the OSF Widgets
  3. The irON JSON Schema used by different JavaScript tools.

The easiest way to re-generate these derivative structures is by going to the OSF Ontology main page, and to click the Update button when you are logged into Drupal as an administrator. This will re-generate the structures. Depending on the number and the size of the ontologies, this may take a few seconds to several minutes.

The other way to do this is to programatically query the Ontology Read endpoint with the function: getSerializedClassHierarchy, getSerializedPropertyHierarchy, getIronJsonSchema and getIronXMLSchema. The results should be saved in the appropriate folders where they are expected by the different tools.

Important Considerations

Missing Type

If a type is missing at time of import, there is an additional consideration to keep in mind: no inference will take place at creation time of the record. This means that no other types will be inferred for the given record. If the missing type is added to the ontology afterward, then the record will still be lacking this inference on its types. So, if it is important that this inference step take place, then the system administrator will have to delete/reload that dataset once the missing type gets added to the ontologies structure. In this manner, the system (or, more precisely, the CRUD: Create code) will be able to create the inferred types at creation time.