|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectaminePlatform.kernel.ontology.Ontology
Title : ontology.Ontology Class
Description : An ontology in AminePlatform is a specialization/generalization graph of Conceptual Structures (CS).
A CS, which corresponds to graph's node, can represent a Concept Type, a Relation Type, an Individual or a Situation:
* Type CS/node (the class Type) : Each concept type and relation type is represented by this type of CS in the ontology. The definition and/or the canon of a type are stored in that node that represents the type in the ontology.
* RelationType CS/node (the class RelationType) : this a specialization of Type and it concerns Relation Type
* Individual CS/node (the class Individual) : An individual of a concept type is represented by an 'individual CS' that is immediately related to its type. The description of an individual is stored in this individual node.
* Situation CS/node (the class Situation) : A situation is stored in a situation node. A situation can be related to types, individuals and/or to other situations.
See classes CS, Type, RelationType, Individual and Situation for more details.
Hence, an ontology is a graph of Conceptual Structures (CS) with one main root (recorded by the ontology attribute 'rootType' which is a Type CS). A direct subtype of the type's main root is the relation root (recorded by the ontology attribute 'relationRoot' which is a RelationType CS).
Like nodes of a graph, each CS cs referes to the immediate CSs that cs specialize (the direct fathers of the CS cs) and to the immediate CSs that are specialization of the CS cs (the immediate children of the CS cs). Thus, the ontology is a specialization/generalization graph and the graph structure of the ontology is implicitly encoded by the links that are specified in each CS. See CS and the related classes for more details.
Also, each ontology is associated to it its lexicons. We make a clear distinction between the lexicons and the ontology : a lexicon contains the association between an identifier in a given language and a CS (which represents its 'meaning') while an ontology contains CSs and the relations between them, resulting in a (huge) graph of CSs. So lexicons and ontology have CSs in common.
To understand more deeply this independence between lexicons and ontology, please note that the description (content) of a CS, which could be a Conceptual Graph (CG) or any other knowledge representation formalism, is not composed of identifiers but of references to other CSs and so they are 'natural language free descriptions'.
Since CSs are 'natural language free descriptions', then the whole ontology is 'natural language free'. The use of identifiers and hence languages and lexicons occurs only when AminePlatform has to communicate or express its knowledge (descriptions) to another language-based system like human !
We can access the graph of CSs that constitute the body of the ontology from its main type root, from a CS/node or from an entry of a lexicon.
Note that the basic operations on an ontology, like addition of a new CS/node, relating CS/node to other CSs/nodes, type hierarchy operations (isSuperType, directSuperTypes, allSuperTypes, minimal common superType, etc.) are defined in the class CS and its subclasses (Type, Individual and Situation).
Finally, an important feature in our definition of lexicons, ontology and CSs is that they are independent and they are not committed to a particular description formalism or scheme. Indeed, content of CS can be any Java Object (see definition of classes CS, Type, Individual and Situation). Hence, different description formalisms (Conceptual Graph (CG), CycList, frame-like structure, RDF, KIF-like notation, etc.) could be used to describe the content of the CS, in so far that they are implemented in Java and allow for descriptions in terms of type, individuals and relations ! In our case, we are using CG and we provide several APIs to deal with them, but to iterate, our definition of lexicons, ontology and CS are not committed to CG only, other notations can be used instead of or beside CG (i.e., we can even define and use an ontology where different notations are used to describe CSs.
Copyright: Copyright (c) Adil KABBAJ, 2004-2009
Field Summary | |
static java.util.HashMap |
hmpKeyContexts
|
static boolean |
loadSynergyOntology
|
static boolean |
toXML
|
Constructor Summary | |
Ontology()
Create an 'empty' Ontology. |
|
Ontology(Identifier rootTypeIdentifier,
Identifier relationRootIdentifier,
Identifier mainLanguage)
Create an ontology with the specified rootTypeIdentifier, rootRelationIdentifier and the mainLanguage. |
|
Ontology(Identifier rootTypeIdentifier,
Identifier relationRootIdentifier,
Identifier mainLanguage,
java.lang.Object[] languages)
Create an ontology with the specified rootTypeIdentifier, rootRelationIdentifier, mainLanguage and languages. |
|
Ontology(Type root)
Create an Ontology with the specified root type. |
|
Ontology(Type root,
RelationType relationRoot)
Create an ontology with the specified root as its root type CS and relationRoot as its relation root. |
Method Summary | |
void |
addEdge(Edge edge)
|
boolean |
addLexicon(Lexicon lexicon)
Add the specified lexicon to the list of lexicons associated to the current ontology. |
void |
addNode(Node node)
|
void |
clear()
Clear will destroy the content of the current ontology, including their lexicons, and it calls the garbage collector System.gc() |
protected void |
destroyOntologyGraph(Type root)
Indepth traversal of the ontology graph to remove all its CSs. |
void |
finalize()
destroy the whole ontology |
java.util.ArrayList |
getArrayLexicons()
|
java.util.Enumeration |
getEdges()
|
protected java.util.Enumeration |
getEdges(Type groot)
|
java.util.Enumeration |
getLanguages()
Get all the languages associated to the current ontology. |
java.lang.Object[] |
getLanguagesInArray()
Get all the languages associated to the current ontology in an array. |
Lexicon |
getLexicon(Identifier language)
Get the lexicon associated to the specified language. |
java.util.Enumeration |
getLexicons()
Get all the lexicons that are associated to the current ontology |
Identifier |
getMainLanguage()
Get the main language that is associated to the current ontology. |
Lexicon |
getMainLexicon()
Get the main lexicon of the current ontology. |
boolean |
getMixedLanguage()
Get the value of the mixedLanguage attribute which is common to all the lexicons associated to the current ontology. |
java.lang.String |
getName()
Deprecated. This period is replaced by getPath() |
int |
getNbrLexicons()
Get the number of lexicons associated to the current ontology |
java.util.Enumeration |
getNodes()
|
protected java.lang.Object[] |
getNodesAndNbr(Type groot)
|
java.lang.String |
getPath()
Get the path of the current ontology. |
RelationType |
getRelationRoot()
Get the relation root of the current ontology. |
Type |
getRoot()
Get the root of the current ontology. |
int |
getSize()
|
static Identifier |
getSynergyRelIdent(java.lang.String sRelType)
|
static RelationType |
getSynergyRelType(java.lang.String sRelType)
|
boolean |
hasIdentifiers(CS cs)
This method checks if the specified cs has identifiers associated to it in some lexicons that are associated to the current ontology. |
static org.jdom.Document |
importOntology(java.lang.String xmlDocumentPath)
Return the XML ontology document existing in the specified path. |
static boolean |
isASynergyIdent(Identifier ident)
|
boolean |
isEmpty()
|
boolean |
isKnownLanguage(Identifier language)
Check if the specified language is among the languages associated to the lexicons of the current ontology. |
boolean |
isMainLanguage(Identifier language)
Check if the given language corresponds to the main lexicon's language |
boolean |
isMainLexicon(Lexicon lexicon)
Check if the given lexicon corresponds to the main lexicon of the current ontology |
boolean |
isMixedLanguage()
Check if the mixedLanguage attribute is true. |
boolean |
isNewLanguage(Identifier language)
The specified language is a new language if it is not among the languages associated to the lexicons of the current ontology. |
boolean |
isNewLanguageName(java.lang.String name)
Check if the specified name is a new language name; no language has such a name among the languages associated to the lexicons of the current ontology. |
static boolean |
isRoot(Type type)
Check if the specified type corresponds to the root of the current ontology |
static boolean |
isSynergyRelation(RelationType relType)
|
static boolean |
isSynergyRelation(java.lang.String sRelType)
|
static Ontology |
load(java.lang.String filePath)
Load to the main memory, by deserialization, the ontology stored in filePath and return the ontology. |
static Ontology |
loadOntologyFromXML(java.lang.String filePath,
ParseCSDescription parseCSDescr)
Load to the main memory, from an XML file, the ontology stored in filePath and return the ontology. |
void |
loadSynergyOntology()
|
void |
makeEmpty()
|
Node |
newNode(java.lang.String name,
Lexicon lexicon)
Implementation of Graph Interface |
Node |
newNode(java.lang.String name,
Lexicon lexicon,
java.lang.String choice)
|
static Ontology |
open(java.lang.String filePath)
This method is equivalent to the method load(String filePath) |
static Ontology |
openOntologyFromXML(java.lang.String filePath,
ParseCSDescription parseCSDescr)
This method is equivalent to the method loadFromXML(String filePath) |
protected static void |
outputDocumentToFile(org.jdom.Document myDocument,
Ontology ontology,
java.lang.String filePath)
Create the Xml document for the current ontology. |
static Ontology |
parseOntologyFromXML(java.lang.String filePath,
ParseCSDescription parseCSDescr)
Parse the XML document in order to produce the internal representation of the ontology. |
static void |
parseXMLSynonyms(Ontology ontology,
Identifier identifier,
org.jdom.Element elementtype)
|
protected Type |
populate(org.jdom.Element ontologyelement,
ParseCSDescription parseCSDescr)
|
boolean |
removeCS(CS cs)
Remove the specified CS cs from the current ontology. |
void |
removeEdge(Edge edge)
|
boolean |
removeLexicon(Lexicon lexicon)
Remove the specified lexicon from the list of lexicons associated to the current ontology. |
void |
removeNode(Node node)
|
void |
save()
|
void |
save(java.lang.String filePath)
This method is equivalent to the method store(String filePath) |
void |
saveInXML(java.lang.String filePath)
This method is equivalent to the method storeInXML(String filePath) |
void |
setLexicons(java.util.ArrayList lexicons)
|
boolean |
setMainLexicon(Lexicon lexicon)
Set the specified lexicon as the main lexicon for the current ontology if the main lexicon was not specified before. |
void |
setMixedLanguage(boolean b)
Set a value for the attribute mixedLanguage. |
void |
setName(java.lang.String path)
Deprecated. This period is replaced by setPath() |
void |
setPath(java.lang.String path)
Set the specified path as the path of the current ontology |
boolean |
setRelationRoot(RelationType relationRoot)
Set the specified type as the relation root of the current ontology if the ontology had no relation root before. |
boolean |
setRoot(Type rootType)
Set the specified type as the root of the current ontology if the ontology had no root before. |
void |
store(java.lang.String filePath)
Store, by serialization, the current ontology in the file filePath. |
void |
storeInXML(java.lang.String filePath)
Store, in an XML file, the current ontology in the file filePath. |
protected void |
toXML(java.lang.String filePath)
|
protected void |
toXMLWithIndepthTraversal(org.jdom.Element element,
Type groot)
Indepth traversal of the ontology graph to create an XML formulation of the Ontology. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean toXML
public static boolean loadSynergyOntology
public static java.util.HashMap hmpKeyContexts
Constructor Detail |
public Ontology() throws OntologyException
OntologyException
- if root is null.public Ontology(Type root) throws OntologyException
root
- The main root type CS. root can not be null.
OntologyException
- if root is null.public Ontology(Type root, RelationType relationRoot) throws OntologyException
root
- The main root type CS. root can not be null.relationRoot
- The relation root CS. relationRoot could be null.
OntologyException
- if root is null.public Ontology(Identifier rootTypeIdentifier, Identifier relationRootIdentifier, Identifier mainLanguage) throws OntologyException
rootTypeIdentifier
- The identifier of the root type. It can not be null.mainLanguage
- The identifier of the main language to associate with the current
ontology. It can not be null.
OntologyException
- if rootTypeIdentifier or mainLanguage is null.public Ontology(Identifier rootTypeIdentifier, Identifier relationRootIdentifier, Identifier mainLanguage, java.lang.Object[] languages) throws java.lang.Exception
rootTypeIdentifier
- The identifier of the root type. It can not be null.mainLanguage
- The identifier of the main language to associate with the current
ontology. It can not be null.languages
- The array of languages to associate with the current ontology. It could
be null and it could contain (or not) the main language.
OntologyException
- if rootTypeIdentifier or mainLanguage is null, or
throws LexiconException if languages contains duplication of languages.
java.lang.Exception
Method Detail |
public static boolean isASynergyIdent(Identifier ident)
public void loadSynergyOntology()
public static boolean isSynergyRelation(RelationType relType)
public static boolean isSynergyRelation(java.lang.String sRelType)
public static RelationType getSynergyRelType(java.lang.String sRelType)
public static Identifier getSynergyRelIdent(java.lang.String sRelType)
public void finalize()
public void clear()
clear
in interface Graph
protected void destroyOntologyGraph(Type root)
public java.util.Enumeration getLexicons()
public java.util.ArrayList getArrayLexicons()
public void setLexicons(java.util.ArrayList lexicons)
public int getNbrLexicons()
public Lexicon getLexicon(Identifier language)
language
- An Identifier
public boolean addLexicon(Lexicon lexicon)
lexicon
- A Lexicon to associate to the current ontology
public boolean removeLexicon(Lexicon lexicon)
lexicon
- A Lexicon to remove from the list of lexicons associated to the current ontology.
public java.util.Enumeration getLanguages()
public java.lang.Object[] getLanguagesInArray()
public Identifier getMainLanguage()
public boolean isMainLanguage(Identifier language)
language
- A language
public Lexicon getMainLexicon()
public boolean setMainLexicon(Lexicon lexicon)
lexicon
- A lexicon to consider as the main lexicon if this one was not
specified before.
public boolean isMainLexicon(Lexicon lexicon)
lexicon
- A lexicon
public boolean getMixedLanguage()
public boolean isMixedLanguage()
public void setMixedLanguage(boolean b)
b
- true to enable mixed language descriptions
and false to desable the possibility of mixed language descriptions.public boolean isKnownLanguage(Identifier language)
language
- An Identifier that represents a language
public boolean isNewLanguage(Identifier language)
language
- A language
public boolean isNewLanguageName(java.lang.String name)
name
- A String
public Type getRoot()
public static boolean isRoot(Type type)
type
-
public RelationType getRelationRoot()
public boolean setRelationRoot(RelationType relationRoot)
relationRoot
- A Type CS to consider as the relation root of the current ontology
public boolean setRoot(Type rootType)
rootType
- A Type CS to consider as the root of the current ontology
public java.lang.String getPath()
public void setPath(java.lang.String path)
path
- The (file) path of the current ontologypublic java.lang.String getName()
public void setName(java.lang.String path)
path
- The (file) path of the current ontologypublic static Ontology open(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file that contain an internal representation
of the ontology
Exceptions
- can occur during the deserialization process
java.lang.Exception
public static Ontology load(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file that contain an internal representation
of the ontology
Exceptions
- can occur during the deserialization process
java.lang.Exception
public void save(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file where the internal representation
of the ontology will be saved
java.lang.Exception
public void store(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file where the internal representation
of the ontology will be stored
java.lang.Exception
public void save() throws java.lang.Exception
java.lang.Exception
public void saveInXML(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file where the XML representation
of the ontology will be saved
java.lang.Exception
public void storeInXML(java.lang.String filePath) throws java.lang.Exception
filePath
- is the file path for the file where the XML representation
of the ontology will be stored
java.lang.Exception
public boolean hasIdentifiers(CS cs)
cs
- A CS
public boolean removeCS(CS cs)
cs
- is the cs to remove from the current ontology
public Node newNode(java.lang.String name, Lexicon lexicon, java.lang.String choice) throws java.lang.Exception
java.lang.Exception
public static Ontology loadOntologyFromXML(java.lang.String filePath, ParseCSDescription parseCSDescr) throws java.lang.Exception
filePath
- is the file path for the file that contain an XML representation
of the ontology
Exceptions
- can occur during the parsing process
java.lang.Exception
public static Ontology openOntologyFromXML(java.lang.String filePath, ParseCSDescription parseCSDescr) throws java.lang.Exception
filePath
- is the file path for the file that contain an XML representation
of the ontology
Exceptions
- can occur during the parsing process
java.lang.Exception
public static Ontology parseOntologyFromXML(java.lang.String filePath, ParseCSDescription parseCSDescr)
protected Type populate(org.jdom.Element ontologyelement, ParseCSDescription parseCSDescr)
public static void parseXMLSynonyms(Ontology ontology, Identifier identifier, org.jdom.Element elementtype)
public static org.jdom.Document importOntology(java.lang.String xmlDocumentPath)
xmlDocumentPath
- is the path of XML document where the ontology is saved in the XML format.
public Node newNode(java.lang.String name, Lexicon lexicon) throws java.lang.Exception
newNode
in interface Graph
java.lang.Exception
public boolean isEmpty()
isEmpty
in interface Graph
public java.util.Enumeration getNodes()
getNodes
in interface Graph
protected java.lang.Object[] getNodesAndNbr(Type groot)
public java.util.Enumeration getEdges()
getEdges
in interface Graph
protected java.util.Enumeration getEdges(Type groot)
public void addEdge(Edge edge)
addEdge
in interface Graph
public void addNode(Node node)
addNode
in interface Graph
public void removeNode(Node node)
removeNode
in interface Graph
public void removeEdge(Edge edge)
removeEdge
in interface Graph
public int getSize()
getSize
in interface Graph
public void makeEmpty()
makeEmpty
in interface Graph
protected void toXMLWithIndepthTraversal(org.jdom.Element element, Type groot)
protected void toXML(java.lang.String filePath)
protected static void outputDocumentToFile(org.jdom.Document myDocument, Ontology ontology, java.lang.String filePath)
myDocument
- ontology
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |