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:
- class/2
- belongs/2
- subclass/2
- restriction/3
Importing and exporting data
This is a data module. Facts can be imported and exported from both prolog fact databases and other formatsImport
The following file formats can be read in using load_biofile/2 and load_bioresource/1- obo
- obo_xml
- go
- owl
- 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 GOBlip 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_owlInstance 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 detailsPredicate 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/3ontology(?ID,?Name)
data predicate (int/ext)ontology(?ID,?Name,?)
data predicate (int/ext)an ontology contains classes and propertiessee also belongs/2class_by_name_or_synonym(+N,?ID)
mode:semidetclass_label(?ID,?Label,?Type)
arguments
Type
: 'exact' for names and exact synonyms; otherwise sysnonym type
subclassN(?Name,?SuperTermName)
mode:nondetqueries subclass parents by NameOfTerm; DirectsubclassTN(+Name,?SuperTermNameTransitive)
mode:nondetqueries subclass parents by NameOfTerm; TransitivesubclassRTN(+Name,?SuperTermNameReflexiveTransitive)
mode:nondetqueries subclass parents by NameOfTerm; Reflexive TransitiverestrictionN(+Name,?RestrictionName,?SuperTermName)
mode:nondetrestrictionN(?Name,?RestrictionName,+SuperTermName)
mode:nondetqueries restriction parents by NameOfTerm; DirectparentN(+Name,?ParentName,?SuperTermName)
mode:nondetparentN(?Name,?ParentName,+SuperTermName)
mode:nondetqueries parent parents by NameOfTerm; Directparent(?ID,?SuperClassID)
mode:nondetparent(?ID,+Property,?SuperClassID)
mode:nondetparent_over(+R,?Via,?ID,?PID)
inferred parentageparent_over_nr(+R,?Via,?ID,?PID)
inferred direct parentageeliminates 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 redundantparent(?ID,+Property,?ParentID,+ViaProperty)
mode:nondetID is linked to its parent ParentID via either subclass, or ViaProperty, or ia one of the subproperties of ViaPropertyparentT(?ID,?SuperClassID)
mode:nondetparentT(?ID,+PropertyList,?SuperClassID)
mode:nondetparentT(?ID,+PropertyList,?SuperClassID,+ViaProperty)
mode:nondet; transitive parent relation via some relationparentRT(?ID,?SuperClassID)
mode:nondetparentRT(?ID,+PropertyList,?SuperClassID)
mode:nondetreferenced_id(?ID,?RefID)
ID references RefID if RefID appears as object of subclass/restriction/intersection relationtopclass(?ID)
mode:nondettop of subclass hierarchytopclass(?C,?O)
top of subclass hierarchy within any one ontologynoparent(?C)
top of union of subclass and restriction hierarchynoparent(?C,?O)
top of DAG in any one ontologynoparent_by_type(?T,?C)
C is a class with no parents of relationship type Tredundant_subclass(?ID,?IDp,?IDz)
mode:nondetfinds intermediate defined class IDz between ID and IDpredundant_parent(?ID,?RelationshipType,?IDp,?IDz,?Path)
mode:nondetfinds 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 PIDmultiple_parent(?ID,?T,?PID1,?PID2)
mode nondetfinds classes with multiple parents of the same timetakes 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 partdoes 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 nondetAs 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:nondetcheck for cyclical paths, going up from IDsubclass cycles are always illegal, and will cause non-terminating behavioursubclass_cycle(+ID,?Path,+InitPath)
mode:nondetparent_cycle(+ID,?Path)
mode:nondetcheck for cyclical paths, going up from ID a parent is defined by subclass/2 or restriction/3parent cycles will cause non-terminating behaviorparent_cycle(+ID,?Path,+InitPath)
mode:nondetbelongs/2
modes
belongs(?(Class), ?(Ontology)): [fact]
arguments
Class
: [pk] class
Ontology
: [fk(ontology)]
cdef/2
child/2
child/3
class/2
modes
class(?(Class), ?(Name)): [fact]
arguments
Class
: [pk]
Name
: [atom]
class_by_name_or_synonym/2
class_comment/2
modes
class_comment(?(Class), ?(Comment)): [fact]
arguments
Class
: [fk(class)]
Comment
: [atom]
class_label/3
class_xref/2
modes
class_xref(?(Class), ?(DBXref)): [fact]
arguments
Class
: [fk(class)]
DBXref
: [fk(dbxref)]
classdef_parent/2
classdef_subsumes_id/2
dangling_class/1
def/2
modes
def(?(Class), ?(DefinitionText)): [fact]
arguments
Class
: [fk(class)]
DefinitionText
: [atom]
def_xref/2
modes
def_xref(?(Class), ?(DBXref)): [fact]
arguments
Class
: [fk(class)]
DBXref
: [fk(dbxref)]
differentium/3
modes
differentium(?(Class), ?(Type), ?(ToClass)): [fact]
arguments
Class
: [fk(class)]
Type
: [atom]
ToClass
: [fk(class)]
genus/2
modes
genus(?(Class), ?(Genus)): [fact]
arguments
Class
: [fk(class)]
Genus
: [fk(class)]
idspace/2
modes
idspace(?(IDSpace), ?(IDSpaceLong)): [fact]
arguments
IDSpace
: [pk]
IDSpaceLong
: [atom]
inst/2
modes
inst(?(Instance), ?(Name)): [fact]
arguments
Instance
: [pk]
Name
: [atom]
inst_of/2
modes
inst_of(?(Instance), ?(Class)): [fact]
arguments
Instance
: [fk(inst)]
Class
: [fk(class)]
inst_ofRT/2
inst_rel/3
modes
inst_rel(?(Instance), ?(Type), ?(ToInstance)): [fact]
arguments
Instance
: [fk(inst)]
Type
: [atom]
ToInstance
: [fk(inst)]
inst_sv/3
inst_sv/4
modes
inst_sv(?(Instance), ?(Type), ?(Value), ?(DataType)): [fact]
arguments
Instance
: [fk(inst)]
Type
: [atom]
Value
: [atom]
DataType
: [atom]
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)]
is_anonymous/1
modes
is_anonymous(?(Class)): [fact]
arguments
Class
: [fk(class)]
is_anti_symmetric/1
modes
is_anti_symmetric(?(Property)): [fact]
arguments
Property
: [fk(property)]
is_reflexive/1
modes
is_reflexive(?(Property)): [fact]
arguments
Property
: [fk(property)]
is_symmetric/1
modes
is_symmetric(?(Property)): [fact]
arguments
Property
: [fk(property)]
is_transitive/1
modes
is_transitive(?(Property)): [fact]
arguments
Property
: [fk(property)]
lexical_category/2
modes
lexical_category(?(Class), ?(Type)): [fact]
arguments
Class
: [fk(class)]
Type
: [atom]
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)]
obsolete_class/2
modes
obsolete_class(?(Class), ?(Name)): [fact]
arguments
Class
: [fk(class)]
Name
: [atom]
ontology/2
ontology/3
modes
ontology(?(Ontology), ?(Name), ?(Desc)): [fact]
arguments
Ontology
: [pk]
Name
: [atom]
Desc
: [atom]
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]
property_domain/2
modes
property_domain(?(Property), ?(Class)): [fact]
arguments
Property
: [fk(property)]
Class
: [fk(class)]
property_range/2
modes
property_range(?(Property), ?(Class)): [fact]
arguments
Property
: [fk(property)]
Class
: [fk(class)]
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)]
restrictionN/3
slot/2
modes
slot(?(Slot), ?(Name)): [fact]
arguments
Slot
: [pk]
Name
: [atom]
subclass/2
modes
subclass(?(Class), ?(SuperClass)): [fact]
arguments
Class
: [fk(class)]
SuperClass
: [fk(class)]
subclassN/2
subclassRT/2
subclassT/2
subclassTN/2
synonym/3
modes
synonym(?(Class), ?(Type), ?(Synonym)): [fact]
arguments
Class
: [fk(class)]
Type
: [atom]
Synonym
: [atom]
topclass/1
topclass/2
transitive_over/2
modes
transitive_over(?(Property), ?(Over)): [fact]
arguments
Property
: [fk(property)]
Over
: [fk(property)]
Metadata
Source
View source: ontol_db.pro
(
plaintext
)