1.41 (checked in on 2006/10/14 at 15:52:58 by dman)
Admin functions to administer the predicate terms definitions.
Functions here relate only to the admin screens where we can add and edit term definitions. None of the functions in this file should be required to be loaded in a read-only environment.
Terms can be defined and added to the term table, preferably via import from RDF.
To get a new predicate to show up in the available relationship types, (left drop down of the node edit) add the 'node type' as a member of the <em>domain</em> of the desired predicate or edit the definition of the node type class_def_link to add the predicate as an <em>available property</em>. Saying 'this property can apply to these types of content' or 'this type of content can have this property' are equivalent.
Pluggable Predicate Ontologies
A module such as ontology_family may be created and enabled. It would declare a bunch of predicates (IsFatherOf, IsMotherOf, IsParentOf, IsChildOf) and their characteristics ( IsMotherOf isSubPropertyOf IsParentOf, IsChildOf isInverseOf IsParentOf ) These predicates are added to the term list when the module is enabled, and become available (on node edit) to anyone who wishes to use them.
Ontologies are best defined and distributed in RDF files.
To restrict or attach certain ontologies to only certain TYPES of node (for example, you may create a custom node type for 'person', and only persons have family relations) the 'domain' of a term can be set. This is analogous to associating node types with a vocabulary.
When sets of terms are grouped in ontologies, node types can be associated with entire ontologies, which is a tidier way of applying related properties.
Characteristics
... are axiomatic (basic,assumed) properties of predicates.
Available characteristics should be used to relate one term with another. Characteristics are modelled on the OWL definitions, and include some basic 'meanings' of term inter-relations. @see apply_characteristics.inc
But sometimes that's not enough.
Custom query responses
Predicate Ontology Modules can also define predicate logic lookups, such as a routine that is called to calculate the results of a request to 'IsCousinOf'. This would return a meaningful result when the the system is asked for all the cousins. This sort of lookup requres some coded, repetative graph walking. If you wanted to encode the logic of a lookup HeirToTheThrone - this is where it would be done.
The functions are hooks of the form relationship_lookup_hook() where 'hook' is the name of the predicate in question.
These graph walks may be arbitrarily complex, and may need to call in many other inferred statements to get to their result. This on-demand sort of query is different from the 'figure out what it means when we get it' or on-save inferencing.
Internally, an example is relationship_lookup_CanHaveProperty(). This callback is fired every time a query is made for the 'CanHaveProperty' relationship. It's a callback, because CanHaveProperty requires class inheiritance support, and the process to answer that question requires the code to look up all owner classes, the properties THEY may have, recursively.
Custom relationship renderings
The ontology libraries are also expected to provide appropriate ways of displaying the relationships at node view time, whether this be by publishing a 'see also' sort of navigation block, @see ontology_navigation.module or using hook_nodeapi() to modify the body output.
ontology_revision_control.module
to see how isReplacedBy causes a warning to appear at the top of a page that is outdated.See the ontology modules for examples on how to make up your own predicate programatically.
Modules can also define their own characteristics and the logical interpretation of what they imply, however that is tricky and should be rare.
See Predicates for more about how I deal with predicate terms.
apply_characteristics.inc for how to code a characteristic.
@todo Use namespaces internally for indexing predicate terms?ontologies
@ingroup docs @package coders @author Dan Morrison http://coders.co.nz/| Name | Description |
|---|---|
| relationship_delete_term | |
| relationship_predicate_form_validate | |
| relationship_save_term | Save a fully-defined term. |
| relationship_term_overview | Display an summary of the properties of the given term |
| relationship_term_path | Return a link to this terms edit/property screen |
| _relationship_predicate_form | Display an edit form for a predicate 'term'. |