You are here

function rdfx_term_types in RDF Extensions 7.2

Returns metadata about term types defined by rdf modules.

If your module needs to determine what term types are being supplied by other modules, call this function. Querying rdfx database tables directly for this information is discouraged. Any additional term types should be added through the corresponding alter hook.

Three major bins of data are stored: tags, value_types, and functions. Each entry in these bins is keyed by the value stored in the actual VotingAPI tables, and contains an array with (minimally) 'name' and 'description' keys. Modules can add extra keys to their entries if desired.

This metadata can be modified or expanded using hook_rdfx_term_types_alter().

Modeled on VotingAPI votingapi_metadata.

Return value

An array of metadata defined by RDFx Terms and altered by rdf modules.

See also

hook_rdfx_term_types_alter()

2 calls to rdfx_term_types()
_rdfx_fetch_terms in ./rdfx.terms.inc
_rdfx_get_terms in ./rdfx.terms.inc

File

./rdfx.terms.inc, line 285
Functions for managing RDF Terms.

Code

function rdfx_term_types($reset = FALSE) {
  static $types;
  if ($reset || !isset($types)) {
    $types['classes']['term_types'] = array();
    $types['properties']['term_types'] = array();
    $term_details = '';

    // @todo Should the inference consider subProp and subClass relationships
    // as well. ie. should all OWL classes also have the type RDFS Class
    // @todo Switch to drupal cache
    $types['classes']['term_types'] = array(
      'rdfs_class' => array(
        'uri' => 'http://www.w3.org/2000/01/rdf-schema#Class',
        'inference' => array(
          'http://www.w3.org/2000/01/rdf-schema#subClassOf' => array(
            'subject',
            'object',
          ),
          'http://www.w3.org/2000/01/rdf-schema#domain' => array(
            'object',
          ),
          'http://www.w3.org/2000/01/rdf-schema#range' => array(
            'object',
          ),
        ),
      ),
      'owl_class' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#Class',
        'inference' => array(
          'http://www.w3.org/2002/07/owl#equivalentClass' => array(
            'subject',
            'object',
          ),
          'http://www.w3.org/2002/07/owl#disjointWith' => array(
            'subject',
            'object',
          ),
        ),
      ),
    );
    $types['properties']['term_types'] = array(
      'rdf_property' => array(
        'uri' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property',
        'inference' => array(
          'http://www.w3.org/2000/01/rdf-schema#domain' => array(
            'subject',
          ),
          'http://www.w3.org/2000/01/rdf-schema#range' => array(
            'subject',
          ),
          'http://www.w3.org/2000/01/rdf-schema#subPropertyOf' => array(
            'subject',
            'object',
          ),
          'http://www.w3.org/2002/07/owl#equivalentProperty' => array(
            'subject',
            'object',
          ),
          'http://www.w3.org/2002/07/owl#inverseOf' => array(
            'subject',
            'object',
          ),
        ),
      ),
      'owl_property_datatype' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#DatatypeProperty',
        'inference' => array(),
      ),
      'owl_property_object' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#ObjectProperty',
        'inference' => array(),
      ),
      'owl_property_functional' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#FunctionalProperty',
        'inference' => array(),
      ),
      'owl_property_inverse_functional' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#InverseFunctionalProperty',
        'inference' => array(),
      ),
      'owl_property_symmetric' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#SymmetricProperty',
        'inference' => array(),
      ),
      'owl_property_asymmetric' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#AsymmetricProperty',
        'inference' => array(),
      ),
      'owl_property_annotation' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#AnnotationProperty',
        'inference' => array(),
      ),
      'owl_property_reflexive' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#ReflexiveProperty',
        'inference' => array(),
      ),
      'owl_property_irreflexive' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#IrreflexiveProperty',
        'inference' => array(),
      ),
      'owl_property_transitive' => array(
        'uri' => 'http://www.w3.org/2002/07/owl#TransitiveProperty',
        'inference' => array(),
      ),
    );
    $types['classes']['description'] = array(
      'superclass' => array(
        'http://www.w3.org/2000/01/rdf-schema#subClassOf' => array(
          'object',
        ),
      ),
      'disjoint' => array(
        'http://www.w3.org/2002/07/owl#disjointWith' => array(
          'object',
        ),
      ),
    );
    $types['properties']['description'] = array(
      'domain' => array(
        'http://www.w3.org/2000/01/rdf-schema#domain' => array(
          'object',
        ),
      ),
      'range' => array(
        'http://www.w3.org/2000/01/rdf-schema#range' => array(
          'object',
        ),
      ),
      'superproperty' => array(
        'http://www.w3.org/2000/01/rdf-schema#subPropertyOf' => array(
          'object',
        ),
      ),
      'inverse' => array(
        'http://www.w3.org/2002/07/owl#inverseOf' => array(
          'object',
        ),
      ),
    );
    drupal_alter('rdfx_term_types', $types);
  }
  return $types;
}