org.opencyc.xml
Class ImportDaml

java.lang.Object
  |
  +--org.opencyc.xml.ImportDaml
All Implemented Interfaces:
com.hp.hpl.jena.rdf.arp.StatementHandler
Direct Known Subclasses:
ImportDamlApp, ImportOpenDirectoryStructure, ImportSonatDaml

public abstract class ImportDaml
extends java.lang.Object
implements com.hp.hpl.jena.rdf.arp.StatementHandler

Abstract class to provide common functions for importing DAML xml content. Subclasses will provide additional behavior tailored for the particular DAML imports.

The Another RDF Parser (ARP) is used to parse the input DAML document. This class implements statement callbacks from ARP. Each triple in the input file causes a call on one of the statement methods. The same triple may occur more than once in a file, causing repeat calls to the method.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Inner Class Summary
protected  class ImportDaml.DamlRestriction
          Records property use restrictions which get imported as Cyc interArgIsa1-2 or interArgFormat1-2 assertions.
protected  class ImportDaml.DamlTermInfo
          Records the DAML term information for Cyc import.
protected  class ImportDaml.MyErrorHandler
          Implements a SAX ErrorHandler to report the XML parsing errors.
 
Field Summary
 boolean actuallyImport
          When T, indicates that the import is performed othwise when false indicates that the DAML document should be parsed but not imported.
protected  com.hp.hpl.jena.rdf.arp.ARP arp
          Another RDF Parser instance.
protected  CycConstant bookkeepingMt
          The #$BookkeepingMt.
protected  java.lang.String characterEncoding
          Character encoding scheme of the DAML input (e.g.
 CycAccess cycAccess
          CycAccess object to manage api connection the the Cyc server.
protected  CycFort damlOntologyDefiningURL
          URL which defines the imported daml ontology
protected  java.lang.String damlOntologyDefiningURLString
          URL string which defines the imported daml ontology
protected  ImportDaml.DamlRestriction damlRestriction
          The current DAML Restriction object being constructed from sequential RDF triples.
static int DEFAULT_VERBOSITY
          The default verbosity of this application.
protected static java.util.HashMap equivalentDamlCycTerms
          Cyc terms which have semantic counterparts in DAML.
protected  CycConstant importMt
          Ontology import microtheory.
protected  java.lang.String importMtName
          Ontology import microtheory name.
protected  CycConstant kbSubsetCollection
          The KB Subset collection which identifies ontology import terms in Cyc.
 java.lang.String kbSubsetCollectionName
          The name of the KB Subset collection which identifies ontology import terms in Cyc.
protected  java.util.HashMap ontologyNicknames
          Ontology library nicknames, which become namespace identifiers upon import into Cyc.
protected  ImportDaml.DamlTermInfo previousDamlTermInfo
          Previously imported term used to avoid redundant assertions.
 int verbosity
          Sets verbosity of this application.
 
Constructor Summary
ImportDaml()
          Constructs a new ImportDaml object.
 
Method Summary
protected  void additionalLexicalAssertions(CycFort term)
          Asserts additional lexical assertions about the given term which are specific to the import of Open Directory terms.
protected  void assertArgumentMapping(java.lang.String damlPropertyName, java.lang.String damlOntology, java.lang.String damlURI, java.lang.String cycBinaryPredicateName, java.lang.String argumentMappingList)
          Asserts that the given DAML/RDFS/RDF property is mapped to the given Cyc predicate with the arguments reversed.
protected  void assertArgumentMapping(java.lang.String damlPropertyName, java.lang.String damlOntology, java.lang.String damlURI, java.lang.String cycBinaryPredicateName, java.lang.String argumentMappingList, java.lang.String mappingMt)
          Asserts that the given DAML/RDFS/RDF property is mapped to the given Cyc predicate with the arguments reversed.
protected  void assertForwardArgConstraints(CycFort term, CycList argConstraints)
          Asserts argument constraints on a forward referenced term used in an assertion.
protected  void assertMapping(java.lang.String damlTermName, java.lang.String damlOntology, java.lang.String damlURI, java.lang.String cycTermName)
          Asserts that the given DAML/RDFS/RDF term is mapped to the given Cyc term, with the assertion placed in #$BaseKB.
protected  void assertMapping(java.lang.String damlTermName, java.lang.String damlOntology, java.lang.String damlURI, java.lang.String cycTermName, java.lang.String mappingMt)
          Asserts that the given DAML/RDFS/RDF term is mapped to the given Cyc term.
protected  CycNart damlTermInfoWrapper(java.lang.String termName)
          Wraps the impored term with the appropriate functional expression so that it can be imported as a NART.
protected  boolean damlTermInfoWrapperTest(java.lang.String termName)
          Determines if the imported term should be wrapped with a functional expression and imported as a NART.
protected  void displayTriple(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo predicateTermInfo, ImportDaml.DamlTermInfo objLitTermInfo)
          Displays the RDF triple.
protected  java.lang.String escaped(java.lang.String text)
          Returns the given string argument with embedded double quote characters escaped.
protected  void getMappings()
          Gets the asserted mappings between DAML/RDFS/RDF terms and Cyc terms.
protected  void getMappings(java.lang.String mappingMt)
          Gets the asserted mappings between DAML/RDFS/RDF terms and Cyc terms.
protected  java.lang.String getOntologyNickname(java.lang.String nameSpace, com.hp.hpl.mesa.rdf.jena.model.Resource resource)
          Returns the ontology nickname for the given XML namespace.
protected  boolean hasUriNamespaceSyntax(java.lang.String uri)
          Returns true if the given URI has embedded XML namespace separators.
protected  void importArg1Isa(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the rdfs:domain triple.
protected  void importArg2Isa(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the rdfs:range triple.
protected  void importComment(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo literalTermInfo)
          Imports the rdfs:comment triple.
protected  void importConceptuallyRelated(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the rdfs:seeAlso triple.
protected  void importContainsInformationAbout(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo uriTermInfo)
          Imports the rdfs:isDefinedBy triple.
 void importDaml(java.lang.String damlOntologyDefiningURLString, java.lang.String importMtName)
          Parses and imports the given DAML URL.
 void importDaml(java.lang.String damlOntologyDefiningURLString, java.lang.String importMtName, java.lang.String characterEncoding)
          Parses and imports the given DAML URL.
protected  void importGenlPreds(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the daml:subPropertyOf triple.
protected  void importGenls(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the rdf:subClassOf triple.
protected  void importImports(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo literalTermInfo)
          Imports the daml:imports triple.
protected  void importIsa(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the rdf:type triple.
protected  void importLiteralTriple(CycFort subject, CycFort predicate, ImportDaml.DamlTermInfo LiteralTermInfo, CycList arg2Constraints)
          Imports the RDF literal triple.
protected  void importNameString(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo literalTermInfo)
          Imports the rdfs:label triple.
protected  void importSynonymousExternalConcept(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo objectTermInfo)
          Imports the daml:samePropertyAs triple.
protected  CycFort importTerm(ImportDaml.DamlTermInfo damlTermInfo)
          Imports the given DAML term and returns the Cyc term.
protected  void importTriple(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo predicateTermInfo, ImportDaml.DamlTermInfo objLitTermInfo)
          Imports the RDF triple.
protected  void importVersionInfo(ImportDaml.DamlTermInfo subjectTermInfo, ImportDaml.DamlTermInfo literalTermInfo)
          Imports the daml:versionInfo triple.
 void initialize()
          Initializes the ImportDaml object.
 void initializeCommonDamlVocabulary()
          Initializes the DAML ontology vocabulary if not present.
 void initializeCommonMappedTerms()
          Initializes common DAML mapped terms.
 void initializeCommonOntologyNicknames()
          Initializes the Ontology nicknames mapping.
 void initializeDamlOntologyMt(java.lang.String mtName)
          Initializes the DAML ontology mt.
protected  boolean isProbableUri(java.lang.String string)
          Returns true if the given string is likely to be a URI.
protected  ImportDaml.DamlTermInfo literal(com.hp.hpl.jena.rdf.arp.ALiteral literal)
          Returns the DamlTerm info of the given RDF literal.
protected  void processRestrictionObject(com.hp.hpl.jena.rdf.arp.AResource subject, com.hp.hpl.jena.rdf.arp.AResource predicate, com.hp.hpl.jena.rdf.arp.AResource object)
          Records the components of a DAML Restriction.
protected  void processRestrictionSubject(com.hp.hpl.jena.rdf.arp.AResource subject, com.hp.hpl.jena.rdf.arp.AResource predicate, com.hp.hpl.jena.rdf.arp.ALiteral literal)
          Records the components of a DAML Restriction.
protected  void processRestrictionSubject(com.hp.hpl.jena.rdf.arp.AResource subject, com.hp.hpl.jena.rdf.arp.AResource predicate, com.hp.hpl.jena.rdf.arp.AResource object)
          Records the components of a DAML Restriction.
protected  ImportDaml.DamlTermInfo resource(com.hp.hpl.jena.rdf.arp.AResource aResource, ImportDaml.DamlTermInfo predicateTermInfo)
          Returns the DamlTerm info of the given RDF resource.
 void setOntologyNickname(java.lang.String uri, java.lang.String nickname)
           
 void setVerbosity(int verbosity)
          Sets verbosity of the constraint solver output.
 void statement(com.hp.hpl.jena.rdf.arp.AResource subject, com.hp.hpl.jena.rdf.arp.AResource predicate, com.hp.hpl.jena.rdf.arp.ALiteral literal)
          Provides the ARP statement handler for triple having an Literal.
 void statement(com.hp.hpl.jena.rdf.arp.AResource subject, com.hp.hpl.jena.rdf.arp.AResource predicate, com.hp.hpl.jena.rdf.arp.AResource object)
          Provides the ARP statement handler for triple having an Object.
protected  com.hp.hpl.mesa.rdf.jena.model.Resource translateResource(com.hp.hpl.jena.rdf.arp.AResource aResource)
          Converts an ARP resource into a Jena resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VERBOSITY

public static final int DEFAULT_VERBOSITY
The default verbosity of this application. 0 --> quiet ... 9 -> maximum diagnostic input.

actuallyImport

public boolean actuallyImport
When T, indicates that the import is performed othwise when false indicates that the DAML document should be parsed but not imported.

verbosity

public int verbosity
Sets verbosity of this application. 0 --> quiet ... 9 -> maximum diagnostic input.

arp

protected com.hp.hpl.jena.rdf.arp.ARP arp
Another RDF Parser instance.

equivalentDamlCycTerms

protected static java.util.HashMap equivalentDamlCycTerms
Cyc terms which have semantic counterparts in DAML. DAML term --> Cyc term

ontologyNicknames

protected java.util.HashMap ontologyNicknames
Ontology library nicknames, which become namespace identifiers upon import into Cyc. namespace uri --> ontologyNickname

previousDamlTermInfo

protected ImportDaml.DamlTermInfo previousDamlTermInfo
Previously imported term used to avoid redundant assertions.

damlOntologyDefiningURLString

protected java.lang.String damlOntologyDefiningURLString
URL string which defines the imported daml ontology

damlOntologyDefiningURL

protected CycFort damlOntologyDefiningURL
URL which defines the imported daml ontology

importMtName

protected java.lang.String importMtName
Ontology import microtheory name.

importMt

protected CycConstant importMt
Ontology import microtheory.

damlRestriction

protected ImportDaml.DamlRestriction damlRestriction
The current DAML Restriction object being constructed from sequential RDF triples.

cycAccess

public CycAccess cycAccess
CycAccess object to manage api connection the the Cyc server.

kbSubsetCollectionName

public java.lang.String kbSubsetCollectionName
The name of the KB Subset collection which identifies ontology import terms in Cyc.

kbSubsetCollection

protected CycConstant kbSubsetCollection
The KB Subset collection which identifies ontology import terms in Cyc.

bookkeepingMt

protected CycConstant bookkeepingMt
The #$BookkeepingMt.

characterEncoding

protected java.lang.String characterEncoding
Character encoding scheme of the DAML input (e.g. UTF-8), specified if not ASCII.
Constructor Detail

ImportDaml

public ImportDaml()
Constructs a new ImportDaml object.
Method Detail

initialize

public void initialize()
                throws java.io.IOException,
                       java.net.UnknownHostException,
                       CycApiException
Initializes the ImportDaml object.

importDaml

public void importDaml(java.lang.String damlOntologyDefiningURLString,
                       java.lang.String importMtName)
                throws java.io.IOException,
                       CycApiException
Parses and imports the given DAML URL.
Parameters:
damlOntologyDefiningURLString - the URL to import
importMtName - the microtheory into which DAML content is asserted

importDaml

public void importDaml(java.lang.String damlOntologyDefiningURLString,
                       java.lang.String importMtName,
                       java.lang.String characterEncoding)
                throws java.io.IOException,
                       CycApiException
Parses and imports the given DAML URL.
Parameters:
damlOntologyDefiningURLString - the URL to import
importMtName - the microtheory into which DAML content is asserted
characterEncoding - the character encoding scheme of the DAML imput (e.g. "UTF-8", used when not the default ASCII

statement

public void statement(com.hp.hpl.jena.rdf.arp.AResource subject,
                      com.hp.hpl.jena.rdf.arp.AResource predicate,
                      com.hp.hpl.jena.rdf.arp.AResource object)
Provides the ARP statement handler for triple having an Object.
Specified by:
statement in interface com.hp.hpl.jena.rdf.arp.StatementHandler
Parameters:
subject - the RDF Triple Subject
predicate - the RDF Triple Predicate
object - the RDF Triple Object

statement

public void statement(com.hp.hpl.jena.rdf.arp.AResource subject,
                      com.hp.hpl.jena.rdf.arp.AResource predicate,
                      com.hp.hpl.jena.rdf.arp.ALiteral literal)
Provides the ARP statement handler for triple having an Literal.
Specified by:
statement in interface com.hp.hpl.jena.rdf.arp.StatementHandler
Parameters:
subject - the RDF Triple Subject
predicate - the RDF Triple Predicate
literal - the RDF Triple Literal

importTriple

protected void importTriple(ImportDaml.DamlTermInfo subjectTermInfo,
                            ImportDaml.DamlTermInfo predicateTermInfo,
                            ImportDaml.DamlTermInfo objLitTermInfo)
                     throws java.io.IOException,
                            java.net.UnknownHostException,
                            CycApiException
Imports the RDF triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
predicateTermInfo - the predicate DamlTermInfo object
objLitTermInfo - the object or literal DamlTermInfo object

importLiteralTriple

protected void importLiteralTriple(CycFort subject,
                                   CycFort predicate,
                                   ImportDaml.DamlTermInfo LiteralTermInfo,
                                   CycList arg2Constraints)
                            throws java.io.IOException,
                                   java.net.UnknownHostException,
                                   CycApiException
Imports the RDF literal triple.
Parameters:
subject - the subject
predicate - the predicate
LiteralTermInfo - the literal DamlTermInfo object
arg2Constraints - the argument constraints on the type of literal permitted by this assertion

escaped

protected java.lang.String escaped(java.lang.String text)
Returns the given string argument with embedded double quote characters escaped.
Parameters:
string - the given string
Returns:
the given string argument with embedded double quote characters escaped

assertForwardArgConstraints

protected void assertForwardArgConstraints(CycFort term,
                                           CycList argConstraints)
                                    throws java.io.IOException,
                                           java.net.UnknownHostException,
                                           CycApiException
Asserts argument constraints on a forward referenced term used in an assertion.
Parameters:
term - the given term
argConstraints - the list of collections for which term must be an instance

importIsa

protected void importIsa(ImportDaml.DamlTermInfo subjectTermInfo,
                         ImportDaml.DamlTermInfo objectTermInfo)
                  throws java.io.IOException,
                         java.net.UnknownHostException,
                         CycApiException
Imports the rdf:type triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importGenls

protected void importGenls(ImportDaml.DamlTermInfo subjectTermInfo,
                           ImportDaml.DamlTermInfo objectTermInfo)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Imports the rdf:subClassOf triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importSynonymousExternalConcept

protected void importSynonymousExternalConcept(ImportDaml.DamlTermInfo subjectTermInfo,
                                               ImportDaml.DamlTermInfo objectTermInfo)
                                        throws java.io.IOException,
                                               java.net.UnknownHostException,
                                               CycApiException
Imports the daml:samePropertyAs triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importArg1Isa

protected void importArg1Isa(ImportDaml.DamlTermInfo subjectTermInfo,
                             ImportDaml.DamlTermInfo objectTermInfo)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Imports the rdfs:domain triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importArg2Isa

protected void importArg2Isa(ImportDaml.DamlTermInfo subjectTermInfo,
                             ImportDaml.DamlTermInfo objectTermInfo)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Imports the rdfs:range triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importConceptuallyRelated

protected void importConceptuallyRelated(ImportDaml.DamlTermInfo subjectTermInfo,
                                         ImportDaml.DamlTermInfo objectTermInfo)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException,
                                         CycApiException
Imports the rdfs:seeAlso triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importGenlPreds

protected void importGenlPreds(ImportDaml.DamlTermInfo subjectTermInfo,
                               ImportDaml.DamlTermInfo objectTermInfo)
                        throws java.io.IOException,
                               java.net.UnknownHostException,
                               CycApiException
Imports the daml:subPropertyOf triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
objectTermInfo - the object DamlTermInfo object

importVersionInfo

protected void importVersionInfo(ImportDaml.DamlTermInfo subjectTermInfo,
                                 ImportDaml.DamlTermInfo literalTermInfo)
                          throws java.io.IOException,
                                 java.net.UnknownHostException,
                                 CycApiException
Imports the daml:versionInfo triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
literalTermInfo - the object DamlTermInfo object

importImports

protected void importImports(ImportDaml.DamlTermInfo subjectTermInfo,
                             ImportDaml.DamlTermInfo literalTermInfo)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Imports the daml:imports triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
literalTermInfo - the object DamlTermInfo object

importComment

protected void importComment(ImportDaml.DamlTermInfo subjectTermInfo,
                             ImportDaml.DamlTermInfo literalTermInfo)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Imports the rdfs:comment triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
literalTermInfo - the object DamlTermInfo object

importNameString

protected void importNameString(ImportDaml.DamlTermInfo subjectTermInfo,
                                ImportDaml.DamlTermInfo literalTermInfo)
                         throws java.io.IOException,
                                java.net.UnknownHostException,
                                CycApiException
Imports the rdfs:label triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
literalTermInfo - the object DamlTermInfo object

importContainsInformationAbout

protected void importContainsInformationAbout(ImportDaml.DamlTermInfo subjectTermInfo,
                                              ImportDaml.DamlTermInfo uriTermInfo)
                                       throws java.io.IOException,
                                              java.net.UnknownHostException,
                                              CycApiException
Imports the rdfs:isDefinedBy triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
literalTermInfo - the object DamlTermInfo object

importTerm

protected CycFort importTerm(ImportDaml.DamlTermInfo damlTermInfo)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Imports the given DAML term and returns the Cyc term.
Parameters:
damlTermInfo - the given daml term information
Returns:
the Cyc term resulting from the import of the given DAML term

damlTermInfoWrapperTest

protected boolean damlTermInfoWrapperTest(java.lang.String termName)
Determines if the imported term should be wrapped with a functional expression and imported as a NART. Subclasses may override for desired behavior.
Parameters:
termName - the daml term to be substituted and wrapped

damlTermInfoWrapper

protected CycNart damlTermInfoWrapper(java.lang.String termName)
                               throws java.io.IOException,
                                      CycApiException
Wraps the impored term with the appropriate functional expression so that it can be imported as a NART. Subclasses may override for desired behavior.
Parameters:
termName - the daml term to be substituted and wrapped

additionalLexicalAssertions

protected void additionalLexicalAssertions(CycFort term)
                                    throws java.io.IOException,
                                           CycApiException
Asserts additional lexical assertions about the given term which are specific to the import of Open Directory terms. Subclasses may override for desired behavior.
Parameters:
term - the imported Open Directory (wrapped) term

displayTriple

protected void displayTriple(ImportDaml.DamlTermInfo subjectTermInfo,
                             ImportDaml.DamlTermInfo predicateTermInfo,
                             ImportDaml.DamlTermInfo objLitTermInfo)
Displays the RDF triple.
Parameters:
subjectTermInfo - the subject DamlTermInfo object
predicateTermInfo - the predicate DamlTermInfo object
objLitTermInfo - the object or literal DamlTermInfo object

resource

protected ImportDaml.DamlTermInfo resource(com.hp.hpl.jena.rdf.arp.AResource aResource,
                                           ImportDaml.DamlTermInfo predicateTermInfo)
Returns the DamlTerm info of the given RDF resource.
Parameters:
aResource - the RDF resource
predicateTermInfo - when processing the RDF triple object, contains the predicate term info, otherwise is null;
Returns:
the DamlTerm info of the given RDF resource

literal

protected ImportDaml.DamlTermInfo literal(com.hp.hpl.jena.rdf.arp.ALiteral literal)
Returns the DamlTerm info of the given RDF literal.
Parameters:
literal - the RDF literal
Returns:
the DamlTerm info of the given RDF literal

isProbableUri

protected boolean isProbableUri(java.lang.String string)
Returns true if the given string is likely to be a URI.
Parameters:
string - the given string
Returns:
true if the given string is likely to be a URI

hasUriNamespaceSyntax

protected boolean hasUriNamespaceSyntax(java.lang.String uri)
Returns true if the given URI has embedded XML namespace separators.
Parameters:
uri - the URI
Returns:
true if the given URI has embedded XML namespace separators, otherwise false

processRestrictionSubject

protected void processRestrictionSubject(com.hp.hpl.jena.rdf.arp.AResource subject,
                                         com.hp.hpl.jena.rdf.arp.AResource predicate,
                                         com.hp.hpl.jena.rdf.arp.AResource object)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException,
                                         CycApiException
Records the components of a DAML Restriction.
Parameters:
subject - the RDF Triple anonymous Subject
predicate - the RDF Triple Predicate
object - the RDF Triple Object

processRestrictionSubject

protected void processRestrictionSubject(com.hp.hpl.jena.rdf.arp.AResource subject,
                                         com.hp.hpl.jena.rdf.arp.AResource predicate,
                                         com.hp.hpl.jena.rdf.arp.ALiteral literal)
                                  throws java.io.IOException,
                                         java.net.UnknownHostException,
                                         CycApiException
Records the components of a DAML Restriction.
Parameters:
subject - the RDF Triple anonymous Subject
predicate - the RDF Triple Predicate
literal - the RDF Triple Literal

processRestrictionObject

protected void processRestrictionObject(com.hp.hpl.jena.rdf.arp.AResource subject,
                                        com.hp.hpl.jena.rdf.arp.AResource predicate,
                                        com.hp.hpl.jena.rdf.arp.AResource object)
                                 throws java.io.IOException,
                                        java.net.UnknownHostException,
                                        CycApiException
Records the components of a DAML Restriction.
Parameters:
subject - the RDF Triple anonymous Subject
predicate - the RDF Triple Predicate
object - the RDF Triple Object

getOntologyNickname

protected java.lang.String getOntologyNickname(java.lang.String nameSpace,
                                               com.hp.hpl.mesa.rdf.jena.model.Resource resource)
Returns the ontology nickname for the given XML namespace.
Parameters:
nameSpace - the XML namespace for which the nickname is sought
resource - the resource containing the namespace, used for error messages
Returns:
the ontology nickname for the given XML namespace

translateResource

protected com.hp.hpl.mesa.rdf.jena.model.Resource translateResource(com.hp.hpl.jena.rdf.arp.AResource aResource)
Converts an ARP resource into a Jena resource.
Parameters:
aResource - The ARP resource.
Returns:
The Jena resource.

initializeDamlOntologyMt

public void initializeDamlOntologyMt(java.lang.String mtName)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Initializes the DAML ontology mt.

initializeCommonOntologyNicknames

public void initializeCommonOntologyNicknames()
Initializes the Ontology nicknames mapping.

setOntologyNickname

public void setOntologyNickname(java.lang.String uri,
                                java.lang.String nickname)

initializeCommonMappedTerms

public void initializeCommonMappedTerms()
                                 throws java.io.IOException,
                                        java.net.UnknownHostException,
                                        CycApiException
Initializes common DAML mapped terms.

assertMapping

protected void assertMapping(java.lang.String damlTermName,
                             java.lang.String damlOntology,
                             java.lang.String damlURI,
                             java.lang.String cycTermName)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Asserts that the given DAML/RDFS/RDF term is mapped to the given Cyc term, with the assertion placed in #$BaseKB.
Parameters:
damlTermName - the given DAML/RDFS/RDF term
damlOntology - the Uniform Resource Locator in which the definition of the daml term is found
damlURI - the Uniform Resource Locator which uniquely identifies the daml term
cycTermName - the given Cyc term

assertMapping

protected void assertMapping(java.lang.String damlTermName,
                             java.lang.String damlOntology,
                             java.lang.String damlURI,
                             java.lang.String cycTermName,
                             java.lang.String mappingMt)
                      throws java.io.IOException,
                             java.net.UnknownHostException,
                             CycApiException
Asserts that the given DAML/RDFS/RDF term is mapped to the given Cyc term.
Parameters:
damlTermName - the given DAML/RDFS/RDF term
damlOntology - the Uniform Resource Locator in which the definition of the daml term is found
damlURI - the Uniform Resource Locator which uniquely identifies the daml term
cycTermName - the given Cyc term
mappingMt - the microtheory in which the assertions are placed

assertArgumentMapping

protected void assertArgumentMapping(java.lang.String damlPropertyName,
                                     java.lang.String damlOntology,
                                     java.lang.String damlURI,
                                     java.lang.String cycBinaryPredicateName,
                                     java.lang.String argumentMappingList)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Asserts that the given DAML/RDFS/RDF property is mapped to the given Cyc predicate with the arguments reversed.
Parameters:
damlPropertyName - the given DAML/RDFS/RDF property
damlOntology - the Uniform Resource Locator in which the definition of the daml term is found
damlURI - the Uniform Resource Locator which uniquely identifies the daml term
cycBinaryPredicateName - the given Cyc binary predicate
mappingMt - the microtheory in which the assertions are placed

assertArgumentMapping

protected void assertArgumentMapping(java.lang.String damlPropertyName,
                                     java.lang.String damlOntology,
                                     java.lang.String damlURI,
                                     java.lang.String cycBinaryPredicateName,
                                     java.lang.String argumentMappingList,
                                     java.lang.String mappingMt)
                              throws java.io.IOException,
                                     java.net.UnknownHostException,
                                     CycApiException
Asserts that the given DAML/RDFS/RDF property is mapped to the given Cyc predicate with the arguments reversed.
Parameters:
damlPropertyName - the given DAML/RDFS/RDF property
damlOntology - the Uniform Resource Locator in which the definition of the daml term is found
damlURI - the Uniform Resource Locator which uniquely identifies the daml term
cycBinaryPredicateName - the given Cyc binary predicate
mappingMt - the microtheory in which the assertions are placed

getMappings

protected void getMappings()
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets the asserted mappings between DAML/RDFS/RDF terms and Cyc terms.

getMappings

protected void getMappings(java.lang.String mappingMt)
                    throws java.io.IOException,
                           java.net.UnknownHostException,
                           CycApiException
Gets the asserted mappings between DAML/RDFS/RDF terms and Cyc terms.
Parameters:
mappingMt - the microtheory from which the assertions are gathered

initializeCommonDamlVocabulary

public void initializeCommonDamlVocabulary()
                                    throws java.io.IOException,
                                           java.net.UnknownHostException,
                                           CycApiException
Initializes the DAML ontology vocabulary if not present.

setVerbosity

public void setVerbosity(int verbosity)
Sets verbosity of the constraint solver output. 0 --> quiet ... 9 -> maximum diagnostic input.
Parameters:
verbosity - 0 --> quiet ... 9 -> maximum diagnostic input