Index

Name

Synopsis

Description

Importing and exporting data

Import

Export

Obo-format files

The ontol module and RDF/OWL

Instance data

Predicate naming conventions

Predicates

inst_sv(?InstID,?PropertyID,?Value)

ontology(?ID,?Name)

ontology(?ID,?Name,?)

class_by_name_or_synonym(+N,?ID)

class_label(?ID,?Label,?Type)

subclassN(?Name,?SuperTermName)

subclassTN(+Name,?SuperTermNameTransitive)

subclassRTN(+Name,?SuperTermNameReflexiveTransitive)

restrictionN(+Name,?RestrictionName,?SuperTermName)

restrictionN(?Name,?RestrictionName,+SuperTermName)

parentN(+Name,?ParentName,?SuperTermName)

parentN(?Name,?ParentName,+SuperTermName)

parent(?ID,?SuperClassID)

parent(?ID,+Property,?SuperClassID)

parent_over(+R,?Via,?ID,?PID)

parent_over_nr(+R,?Via,?ID,?PID)

parent(?ID,+Property,?ParentID,+ViaProperty)

parentT(?ID,?SuperClassID)

parentT(?ID,+PropertyList,?SuperClassID)

parentT(?ID,+PropertyList,?SuperClassID,+ViaProperty)

parentRT(?ID,?SuperClassID)

parentRT(?ID,+PropertyList,?SuperClassID)

referenced_id(?ID,?RefID)

topclass(?ID)

topclass(?C,?O)

noparent(?C)

noparent(?C,?O)

noparent_by_type(?T,?C)

redundant_subclass(?ID,?IDp,?IDz)

redundant_parent(?ID,?RelationshipType,?IDp,?IDz,?Path)

multiple_parent(?ID,?T,?PID1,?PID2)

multiple_parent(?ID,?T,?PID1,?PID2,?ViaID)

subclass_cycle(+ID,?Path)

subclass_cycle(+ID,?Path,+InitPath)

parent_cycle(+ID,?Path)

parent_cycle(+ID,?Path,+InitPath)

belongs/2

cdef/2

child/2

child/3

class/2

class_by_name_or_synonym/2

class_comment/2

class_label/3

class_xref/2

classdef_parent/2

classdef_subsumes_id/2

dangling_class/1

def/2

def_xref/2

differentium/3

genus/2

idspace/2

inst/2

inst_of/2

inst_ofRT/2

inst_rel/3

inst_sv/3

inst_sv/4

instance_ofRT/2

instance_ofT/2

instance_ofX/2

inverse_of/2

is_anonymous/1

is_anti_symmetric/1

is_reflexive/1

is_symmetric/1

is_transitive/1

lexical_category/2

multiple_parent/4

multiple_parent/5

nochild/1

nochild/2

noparent/1

noparent/2

noparent_by_type/2

obsolete/3

obsolete_class/2

ontology/2

ontology/3

parent/2

parent/3

parentRT/2

parentRT/3

parentRT/4

parentT/2

parentT/3

parentT/4

parentTmin/3

parent_cycle/2

parent_over/3

parent_over/4

parent_overRT/3

parent_overT/3

parent_over_nr/3

parent_over_nr/4

parent_path/3

property/2

property_domain/2

property_range/2

redundant_parent/5

redundant_subclass/3

referenced_id/2

restriction/3

restrictionN/3

slot/2

subclass/2

subclassN/2

subclassRT/2

subclassT/2

subclassTN/2

synonym/3

topclass/1

topclass/2

transitive_over/2

Metadata

Source

Name

ontol_db - ontology classes and instances - datalog schema

Synopsis

  :- use_module(bio(ontol_db)).
  :- use_module(bio(io)).

  % find all superclasses of a particular class
  demo:-
    load_bioresource(go),
    class(ID,'transcription factor activity'),
    setof(ParentID,subclassRT(ID,ParentID),ParentIDs),
    writeln(parents=ParentIDs).    
  

Description

This module contains defines extensional and intensional data predicates that model ontology and instance data. The data model is obo-like, and can easily be mapped to an OWL ontology (see bridge)

The basic querying is such things as transitive relationships and detecting illegal cycles or redundant relationships. It requires ontology prolog fact files containing at least the following facts:

Any cycles over subclass/2 or restriction/3 will cause non-terminating behavior

Importing and exporting data

This is a data module. Facts can be imported and exported from both prolog fact databases and other formats

Import

The following file formats can be read in using load_biofile/2 and load_bioresource/1

  • obo
  • obo_xml
  • go
  • owl
(See below for full details)

The following database schemas have adapters:

  • gosql

Export

The following file formats can be written using write_biofile/2

  • OWL - (ensure_loaded ontol_bridge_to_owl)

Obo-format files

This is a format commonly used for bio-ontologies See GO

Blip contains an experimental pure-prolog parser (see parser_obo), which can be invoked by using the file format atom 'obo_native'. For now the default is to invoke the go-perl go2prolog script which generates prolog fact files. This should all happen behind the scenes, just specifify the file format 'obo'

The ontol module and RDF/OWL

The data predicates defined in this module map fairly well to OWL. As well as loading the data predicates directly from an OBO-formatted file (as is common in the bio-ontologies world), the data predicates can map to predicates defined in the SWI-Prolog rdb_db module - see ontol_bridge_from_owl

Instance data

As well as modeling ontologies consisting purely of class data, this module also handles instance data. A generic free model is used to store instances, similar to most frame-based systems, RDF and OWL. In principle, any kind of data can be modeled as instances belong to a particular class. This means that the ontol module can provide an object system for modeling data. See inst/2, inst_rel/3 and inst_sv/4 for details

Predicate naming conventions

Typically the modes of the inference predicates are defined such that parents are infered from children, rather than vice versa

  • T - transitive
  • R - reflexive (includes self)
  • RT - reflexive transitive
  • N - uses names rather than IDs to refer to classes

Predicates

inst_sv(?InstID,?PropertyID,?Value)

data predicate (intensional) this is the union of inst_sv/4 and inst_rel/3

ontology(?ID,?Name)

data predicate (int/ext)

ontology(?ID,?Name,?)

data predicate (int/ext)

an ontology contains classes and properties

see also belongs/2

class_by_name_or_synonym(+N,?ID)

mode:semidet

class_label(?ID,?Label,?Type)

arguments

Type : 'exact' for names and exact synonyms; otherwise sysnonym type

subclassN(?Name,?SuperTermName)

mode:nondet

queries subclass parents by NameOfTerm; Direct

subclassTN(+Name,?SuperTermNameTransitive)

mode:nondet

queries subclass parents by NameOfTerm; Transitive

subclassRTN(+Name,?SuperTermNameReflexiveTransitive)

mode:nondet

queries subclass parents by NameOfTerm; Reflexive Transitive

restrictionN(+Name,?RestrictionName,?SuperTermName)

mode:nondet

restrictionN(?Name,?RestrictionName,+SuperTermName)

mode:nondet

queries restriction parents by NameOfTerm; Direct

parentN(+Name,?ParentName,?SuperTermName)

mode:nondet

parentN(?Name,?ParentName,+SuperTermName)

mode:nondet

queries parent parents by NameOfTerm; Direct

parent(?ID,?SuperClassID)

mode:nondet

parent(?ID,+Property,?SuperClassID)

mode:nondet

parent_over(+R,?Via,?ID,?PID)

inferred parentage

parent_over_nr(+R,?Via,?ID,?PID)

inferred direct parentage

eliminates redundancy; for example, if X part_of organelle, and nucleus is_a+ organelle, and X can be inferred to be part_of a nucleus, then X part_of organelle is redundant

parent(?ID,+Property,?ParentID,+ViaProperty)

mode:nondet

ID is linked to its parent ParentID via either subclass, or ViaProperty, or ia one of the subproperties of ViaProperty

parentT(?ID,?SuperClassID)

mode:nondet

parentT(?ID,+PropertyList,?SuperClassID)

mode:nondet

parentT(?ID,+PropertyList,?SuperClassID,+ViaProperty)

mode:nondet; transitive parent relation via some relation

parentRT(?ID,?SuperClassID)

mode:nondet

parentRT(?ID,+PropertyList,?SuperClassID)

mode:nondet

referenced_id(?ID,?RefID)

ID references RefID if RefID appears as object of subclass/restriction/intersection relation

topclass(?ID)

mode:nondet

top of subclass hierarchy

topclass(?C,?O)

top of subclass hierarchy within any one ontology

noparent(?C)

top of union of subclass and restriction hierarchy

noparent(?C,?O)

top of DAG in any one ontology

noparent_by_type(?T,?C)

C is a class with no parents of relationship type T

redundant_subclass(?ID,?IDp,?IDz)

mode:nondet

finds intermediate defined class IDz between ID and IDp

redundant_parent(?ID,?RelationshipType,?IDp,?IDz,?Path)

mode:nondet

finds parent/3 relationships that are redundant.

eg when ID is part of PID, but ID is a kind of Z which is a part_of PID

multiple_parent(?ID,?T,?PID1,?PID2)

mode nondet

finds classes with multiple parents of the same time

takes into account the rule:

if X is_a* Y and Y part_of Z then X part_of Z

(substitute part_of for any other relation T here)

PID1 must be a direct part_of ID, but PID2 can be an indirect part

does not report if PID1 is_a* PID2 (because they are not distinct parts)

Note that this will unify with duplicate results as PID1 and PID2 are symmeryical. When PID1 and PID2 are unground, you can de-duplicate like this:

  multiple_parent(ID,part_of,PID1,PID2),
  PID1<PID2.
  

multiple_parent(?ID,?T,?PID1,?PID2,?ViaID)

mode nondet

As multiple_parent/4 but also provides the ID of the class ViaID such that PID2 is a direct part_of ViaID (and ViaID is a superclass* of ID)

PID1 is always a direct part_of ID

(substitute part_of for any other relation T here)

subclass_cycle(+ID,?Path)

mode:nondet

check for cyclical paths, going up from ID

subclass cycles are always illegal, and will cause non-terminating behaviour

subclass_cycle(+ID,?Path,+InitPath)

mode:nondet

parent_cycle(+ID,?Path)

mode:nondet

check for cyclical paths, going up from ID a parent is defined by subclass/2 or restriction/3

parent cycles will cause non-terminating behavior

parent_cycle(+ID,?Path,+InitPath)

mode:nondet

belongs/2

modes

belongs(?(Class), ?(Ontology)): [fact]

arguments

Class : [pk] class

Ontology : [fk(ontology)]

<< Extensional (fact) predicate - must be loaded from external data source>>

every class belongs to an ontology

cdef/2

child/2

child/3

class/2

modes

class(?(Class), ?(Name)): [fact]

arguments

Class : [pk]

Name : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

An ontology class, type or term

class_by_name_or_synonym/2

class_comment/2

modes

class_comment(?(Class), ?(Comment)): [fact]

arguments

Class : [fk(class)]

Comment : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

class_label/3

class_xref/2

modes

class_xref(?(Class), ?(DBXref)): [fact]

arguments

Class : [fk(class)]

DBXref : [fk(dbxref)]

<< Extensional (fact) predicate - must be loaded from external data source>>

classdef_parent/2

classdef_subsumes_id/2

dangling_class/1

def/2

modes

def(?(Class), ?(DefinitionText)): [fact]

arguments

Class : [fk(class)]

DefinitionText : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

natural language definition, one per class

def_xref/2

modes

def_xref(?(Class), ?(DBXref)): [fact]

arguments

Class : [fk(class)]

DBXref : [fk(dbxref)]

<< Extensional (fact) predicate - must be loaded from external data source>>

differentium/3

modes

differentium(?(Class), ?(Type), ?(ToClass)): [fact]

arguments

Class : [fk(class)]

Type : [atom]

ToClass : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

characteristics that distinguish Class from others with the same Genus

genus/2

modes

genus(?(Class), ?(Genus)): [fact]

arguments

Class : [fk(class)]

Genus : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

base class in logical definition

idspace/2

modes

idspace(?(IDSpace), ?(IDSpaceLong)): [fact]

arguments

IDSpace : [pk]

IDSpaceLong : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

inst/2

modes

inst(?(Instance), ?(Name)): [fact]

arguments

Instance : [pk]

Name : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

inst_of/2

modes

inst_of(?(Instance), ?(Class)): [fact]

arguments

Instance : [fk(inst)]

Class : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

inst_ofRT/2

inst_rel/3

modes

inst_rel(?(Instance), ?(Type), ?(ToInstance)): [fact]

arguments

Instance : [fk(inst)]

Type : [atom]

ToInstance : [fk(inst)]

<< Extensional (fact) predicate - must be loaded from external data source>>

inst_sv/3

inst_sv/4

modes

inst_sv(?(Instance), ?(Type), ?(Value), ?(DataType)): [fact]

arguments

Instance : [fk(inst)]

Type : [atom]

Value : [atom]

DataType : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

instance_ofRT/2

instance_ofT/2

instance_ofX/2

inverse_of/2

modes

inverse_of(?(Property), ?(Inverse)): [fact]

arguments

Property : [fk(property)]

Inverse : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

is_anonymous/1

modes

is_anonymous(?(Class)): [fact]

arguments

Class : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

is_anti_symmetric/1

modes

is_anti_symmetric(?(Property)): [fact]

arguments

Property : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

is_reflexive/1

modes

is_reflexive(?(Property)): [fact]

arguments

Property : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

is_symmetric/1

modes

is_symmetric(?(Property)): [fact]

arguments

Property : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

is_transitive/1

modes

is_transitive(?(Property)): [fact]

arguments

Property : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

lexical_category/2

modes

lexical_category(?(Class), ?(Type)): [fact]

arguments

Class : [fk(class)]

Type : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

multiple_parent/4

multiple_parent/5

nochild/1

nochild/2

noparent/1

noparent/2

noparent_by_type/2

obsolete/3

modes

obsolete(?(Class), ?(Name), ?(Ontology)): [fact]

arguments

Class : [fk(class)]

Name : [atom]

Ontology : [fk(ontology)]

<< Extensional (fact) predicate - must be loaded from external data source>>

obsolete_class/2

modes

obsolete_class(?(Class), ?(Name)): [fact]

arguments

Class : [fk(class)]

Name : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

ontology/2

ontology/3

modes

ontology(?(Ontology), ?(Name), ?(Desc)): [fact]

arguments

Ontology : [pk]

Name : [atom]

Desc : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

parent/2

parent/3

parentRT/2

parentRT/3

parentRT/4

parentT/2

parentT/3

parentT/4

parentTmin/3

parent_cycle/2

parent_over/3

parent_over/4

parent_overRT/3

parent_overT/3

parent_over_nr/3

parent_over_nr/4

parent_path/3

property/2

modes

property(?(Property), ?(Name)): [fact]

arguments

Property : [pk]

Name : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

a relation OR a datatype property (slot)

property_domain/2

modes

property_domain(?(Property), ?(Class)): [fact]

arguments

Property : [fk(property)]

Class : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

property_range/2

modes

property_range(?(Property), ?(Class)): [fact]

arguments

Property : [fk(property)]

Class : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

redundant_parent/5

redundant_subclass/3

referenced_id/2

restriction/3

modes

restriction(?(Class), ?(Type), ?(ToClass)): [fact]

arguments

Class : [fk(class)]

Type : [atom] NAME of a relation

ToClass : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

typed non-ISA relationship

restrictionN/3

slot/2

modes

slot(?(Slot), ?(Name)): [fact]

arguments

Slot : [pk]

Name : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

subclass/2

modes

subclass(?(Class), ?(SuperClass)): [fact]

arguments

Class : [fk(class)]

SuperClass : [fk(class)]

<< Extensional (fact) predicate - must be loaded from external data source>>

ISA relationship

subclassN/2

subclassRT/2

subclassT/2

subclassTN/2

synonym/3

modes

synonym(?(Class), ?(Type), ?(Synonym)): [fact]

arguments

Class : [fk(class)]

Type : [atom]

Synonym : [atom]

<< Extensional (fact) predicate - must be loaded from external data source>>

topclass/1

topclass/2

transitive_over/2

modes

transitive_over(?(Property), ?(Over)): [fact]

arguments

Property : [fk(property)]

Over : [fk(property)]

<< Extensional (fact) predicate - must be loaded from external data source>>

Metadata

version: 1.30
date: 2006/03/18 03:35:06
author: Chris Mungall
license: LGPL

Source

View source: ontol_db.pro ( plaintext )