Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.opencyc.xml
Class ExportDaml

    java.lang.Object
      |
      +--org.opencyc.xml.ExportDaml

public class ExportDaml
extends java.lang.Object

DAML+OIL export for OpenCyc.

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.

Field Summary
`CycList` | `applicableBinaryPredicates` List of applicable binary predicates.
`CycFort` | `cycKbSubsetCollection` The CycKBSubsetCollection whose elements are exported to DAML.
`Guid` | `cycKbSubsetCollectionGuid` The CycKBSubsetCollection whose elements are exported to DAML.
`protected CycFort` | `cycKbSubsetFilter` The CycKBSubsetCollection whose elements are exported to DAML if they also generalizations of cycKbSubsetCollectionGuid collections or predicates above.
`Guid` | `cycKbSubsetFilterGuid` The guid which identifies the CycKBSubsetCollection whose elements are exported to DAML if they also generalizations of cycKbSubsetCollectionGuid collections or predicates above.
`protected static int` | `DEFAULT_VERBOSITY` The default verbosity of the DAML export output.
`static int` | `EXPORT_ENTIRE_KB` Command indicating that the DAML export contains all the terms in the KB.
`static int` | `EXPORT_KB_SUBSET` Command indicating that the DAML export contains only the marked KB subset terms.
`static int` | `EXPORT_KB_SUBSET_BELOW_TERM` Command indicating that the DAML export contains the collections whose direct or indirect genl is the collection term indentified by rootTermGuid.
`static int` | `EXPORT_KB_SUBSET_PLUS_UPWARD_CLOSURE` Command indicating that the DAML export contains the marked KB subset terms plus all the terms in the upward closure to #$Thing.
`protected int` | `exportCommand` The command performed by the DAML extract process.
`boolean` | `includeUpwardClosure` Indicates whether the upward closure of terms should be exported.
`java.lang.String` | `outputPath` The DAML export path and file name.
`CycFort` | `rootTerm` Used in the export command EXPORT_KB_SUBSET_BELOW_TERM.
`Guid` | `rootTermGuid` Used in the export command EXPORT_KB_SUBSET_BELOW_TERM.
`java.lang.String` | `title` The DAML comment that titles the output file.
`int` | `verbosity` Sets verbosity of the DAML export output.

Constructor Summary
`ExportDaml(CycAccess cycAccess)` Constructs a new ExportDaml object given the CycAccess object.

Method Summary
`protected java.util.ArrayList` | `applyCycKbSubsetFilter(CycList constants)` Removes terms from the given list which are not elements of cycKbSubsetFilter.
`protected CycConstant` | `bestIsaForIndividual()` Returns the best isa for the current Individual term.
`protected void` | `createClassNode(CycConstant cycConstant)` Creates a DAML class node for a single Cyc collection.
`protected void` | `createConstantNode(CycConstant cycConstant)` Creates a DAML node for a single Cyc Constant.
`protected void` | `createCycGuidNode()` Creates the DAML node that defines the guid property.
`protected void` | `createDamlOntologyNode()` Creates a DAML Ontology node.
`protected void` | `createIndividualNode(CycConstant cycConstant)` Creates a DAML individual node for a single Cyc individual.
`protected void` | `createPropertyAssertionNodes(org.w3c.dom.Element node)` Creates a property assertions node for the given Element.
`protected void` | `createPropertyNode(CycConstant cycConstant)` Creates a DAML property node for a single Cyc binary predicate.
`protected void` | `createRdfNode()` Creates an RDF node.
`void` | `export(int exportCommand)` Exports the desired KB content into DAML.
`protected CycList` | `filterSelectedConstants(CycList constants)` Removes unselected terms from the given list.
`protected CycList` | `gatherUpwardClosure(CycList selectedCycForts)` Gather the updward closure of the selected CycForts with regard to isas and genls for collection terms, and with regard to genlPreds for predicate terms.
`protected boolean` | `isFilteredDamlSelectedConstant(java.lang.Object object)` Return True iff the object is a selected constant.
`protected boolean` | `isFilteredSelectedConstant(java.lang.Object object)` Return True iff the object is a instance of the desired KB subset collection
`protected void` | `populateArg1Format(CycConstant cycConstant)` Populates the argument 1 format for a Cyc predicate.
`protected void` | `populateArg1Isa(CycConstant cycConstant)` Populates the argument 1 type constaint for a Cyc predicate.
`protected void` | `populateArg2Format(CycConstant cycConstant)` Populates the argument 2 format for a Cyc predicate.
`protected void` | `populateArg2Isa(CycConstant cycConstant)` Populates the argument 2 type constaint for a Cyc predicate.
`protected void` | `populateCoExtensionals(CycConstant cycConstant)` Populates the coExtensionals for a Cyc collection.
`protected void` | `populateComment(CycConstant cycConstant)` Populates the comment for a Cyc term.
`protected void` | `populateDisjointWiths(CycConstant cycConstant)` Populates the disjointWiths for a Cyc collection.
`protected void` | `populateGenlPreds(CycConstant cycConstant)` Populates the genlPreds for a Cyc predicate.
`protected void` | `populateGenls(CycConstant cycConstant)` Populates the genls for a Cyc term.
`protected void` | `populateIsas(CycConstant cycConstant)` Populates the isas for a Cyc term.
`protected void` | `populatePropertyAssertions(CycConstant cycConstant)` Populates the non-definitional ground atomic formulas in which the the predicate is an element of the list of applicable binary predicates and in which the given term appears as the first argument.
`protected void` | `setup()` Sets up the DAML export process.
`protected CycList` | `substituteGenlConstantsForNarts(CycList cycForts)` Substitutes more general collection constants for functional collection terms.
`protected java.lang.String` | `translateTerm(CycConstant cycConstant)` Translates a Cyc term into a kind of DAML node: DAML Thing, DAML class, DAML property or DAML transitive property.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EXPORT_KB_SUBSET

    public static final int EXPORT_KB_SUBSET

  Command indicating that the DAML export contains only the marked KB subset terms. cycKbSubsetCollectionGuid contains the KB subset collection's guid. cycKbSubsetFilterGuid contains the guid for the KB subset term that filters membership in the upward closure.

### EXPORT_KB_SUBSET_PLUS_UPWARD_CLOSURE

    public static final int EXPORT_KB_SUBSET_PLUS_UPWARD_CLOSURE

  Command indicating that the DAML export contains the marked KB subset terms plus all the terms in the upward closure to #$Thing. cycKbSubsetCollectionGuid contains the KB subset collection's guid.

### EXPORT_KB_SUBSET_BELOW_TERM

    public static final int EXPORT_KB_SUBSET_BELOW_TERM

  Command indicating that the DAML export contains the collections whose direct or indirect genl is the collection term indentified by rootTermGuid. cycKbSubsetFilterGuid contains the guid for the KB subset term that filters membership in the export set.

### EXPORT_ENTIRE_KB

    public static final int EXPORT_ENTIRE_KB

  Command indicating that the DAML export contains all the terms in the KB.

### exportCommand

    protected int exportCommand

  The command performed by the DAML extract process.

### DEFAULT_VERBOSITY

    protected static final int DEFAULT_VERBOSITY

  The default verbosity of the DAML export output. 0 --> quiet ... 9 -> maximum diagnostic input.

### verbosity

    public int verbosity

  Sets verbosity of the DAML export output. 0 --> quiet ... 9 -> maximum diagnostic input.

### includeUpwardClosure

    public boolean includeUpwardClosure

  Indicates whether the upward closure of terms should be exported. If so, the upward closure terms are filtered by cycKbSubsetFilterGuid below.

### cycKbSubsetCollection

    public CycFort cycKbSubsetCollection

  The CycKBSubsetCollection whose elements are exported to DAML.

### cycKbSubsetCollectionGuid

    public Guid cycKbSubsetCollectionGuid

  The CycKBSubsetCollection whose elements are exported to DAML.

### cycKbSubsetFilterGuid

    public Guid cycKbSubsetFilterGuid

  The guid which identifies the CycKBSubsetCollection whose elements are exported to DAML if they also generalizations of cycKbSubsetCollectionGuid collections or predicates above. #$IKBConstant (not in OpenCyc)

### cycKbSubsetFilter

    protected CycFort cycKbSubsetFilter

  The CycKBSubsetCollection whose elements are exported to DAML if they also generalizations of cycKbSubsetCollectionGuid collections or predicates above. #$IKBConstant (not in OpenCyc)

### applicableBinaryPredicates

    public CycList applicableBinaryPredicates

  List of applicable binary predicates.

### rootTermGuid

    public Guid rootTermGuid

  Used in the export command EXPORT_KB_SUBSET_BELOW_TERM. The DAML export contains the collections whose direct or indirect genl is the collection term indentified by this value.

### rootTerm

    public CycFort rootTerm

  Used in the export command EXPORT_KB_SUBSET_BELOW_TERM. The DAML export contains the collections whose direct or indirect genl is this collection term.

### outputPath

    public java.lang.String outputPath

  The DAML export path and file name.

### title

    public java.lang.String title

  The DAML comment that titles the output file.

Constructor Detail

### ExportDaml

    public ExportDaml(CycAccess cycAccess)

  Constructs a new ExportDaml object given the CycAccess object.
  Parameters:
    `cycAccess` - the CycAccess object which manages the api connection

Method Detail

### export

    public void export(int exportCommand)
                throws java.net.UnknownHostException,
                       java.io.IOException,
                       CycApiException

  Exports the desired KB content into DAML.

### setup

    protected void setup()
                  throws java.net.UnknownHostException,
                         java.io.IOException,
                         CycApiException

  Sets up the DAML export process.

### createRdfNode

    protected void createRdfNode()

  Creates an RDF node.

### createDamlOntologyNode

    protected void createDamlOntologyNode()

  Creates a DAML Ontology node.

### createConstantNode

    protected void createConstantNode(CycConstant cycConstant)
                               throws java.net.UnknownHostException,
                                      java.io.IOException,
                                      CycApiException

  Creates a DAML node for a single Cyc Constant.

### createClassNode

    protected void createClassNode(CycConstant cycConstant)
                            throws java.net.UnknownHostException,
                                   java.io.IOException,
                                   CycApiException

  Creates a DAML class node for a single Cyc collection.

### createPropertyAssertionNodes

    protected void createPropertyAssertionNodes(org.w3c.dom.Element node)
                                         throws java.net.UnknownHostException,
                                                java.io.IOException,
                                                CycApiException

  Creates a property assertions node for the given Element.
  Parameters:
    `element` - the given element

### createIndividualNode

    protected void createIndividualNode(CycConstant cycConstant)
                                 throws java.net.UnknownHostException,
                                        java.io.IOException,
                                        CycApiException

  Creates a DAML individual node for a single Cyc individual.

### bestIsaForIndividual

    protected CycConstant bestIsaForIndividual()
                                        throws java.net.UnknownHostException,
                                               java.io.IOException,
                                               CycApiException

  Returns the best isa for the current Individual term.
  Returns:
    the best isa for the current Individual term

### createCycGuidNode

    protected void createCycGuidNode()

  Creates the DAML node that defines the guid property.

### createPropertyNode

    protected void createPropertyNode(CycConstant cycConstant)
                               throws java.net.UnknownHostException,
                                      java.io.IOException,
                                      CycApiException

  Creates a DAML property node for a single Cyc binary predicate.

### translateTerm

    protected java.lang.String translateTerm(CycConstant cycConstant)
                                      throws java.net.UnknownHostException,
                                             java.io.IOException,
                                             CycApiException

  Translates a Cyc term into a kind of DAML node: DAML Thing, DAML class, DAML property or DAML transitive property.
  Returns:
    the kind of DAML node: DAML Thing, DAML class, DAML property or DAML transitive property

### populateComment

    protected void populateComment(CycConstant cycConstant)
                            throws java.net.UnknownHostException,
                                   java.io.IOException,
                                   CycApiException

  Populates the comment for a Cyc term.

### applyCycKbSubsetFilter

    protected java.util.ArrayList applyCycKbSubsetFilter(CycList constants)
                                                  throws java.net.UnknownHostException,
                                                         java.io.IOException,
                                                         CycApiException

  Removes terms from the given list which are not elements of cycKbSubsetFilter.
  Returns:
    the filtered list

### filterSelectedConstants

    protected CycList filterSelectedConstants(CycList constants)

  Removes unselected terms from the given list.
  Returns:
    the filtered list

### substituteGenlConstantsForNarts

    protected CycList substituteGenlConstantsForNarts(CycList cycForts)
                                               throws java.net.UnknownHostException,
                                                      java.io.IOException,
                                                      CycApiException

  Substitutes more general collection constants for functional collection terms.
  Returns:
    the list of collection constant terms resulting from the substitution of more general cycConstants for cycNarts

### isFilteredDamlSelectedConstant

    protected boolean isFilteredDamlSelectedConstant(java.lang.Object object)

  Return True iff the object is a selected constant. (DAML does not now contain non-binary predicates nor function terms.)
  Returns:
    True iff the object is a selected constant

### isFilteredSelectedConstant

    protected boolean isFilteredSelectedConstant(java.lang.Object object)
                                          throws java.net.UnknownHostException,
                                                 java.io.IOException,
                                                 CycApiException

  Return True iff the object is a instance of the desired KB subset collection

### populateIsas

    protected void populateIsas(CycConstant cycConstant)
                         throws java.net.UnknownHostException,
                                java.io.IOException,
                                CycApiException

  Populates the isas for a Cyc term.

### populateGenls

    protected void populateGenls(CycConstant cycConstant)
                          throws java.net.UnknownHostException,
                                 java.io.IOException,
                                 CycApiException

  Populates the genls for a Cyc term.

### populateGenlPreds

    protected void populateGenlPreds(CycConstant cycConstant)
                              throws java.net.UnknownHostException,
                                     java.io.IOException,
                                     CycApiException

  Populates the genlPreds for a Cyc predicate.

### populateArg1Isa

    protected void populateArg1Isa(CycConstant cycConstant)
                            throws java.net.UnknownHostException,
                                   java.io.IOException,
                                   CycApiException

  Populates the argument 1 type constaint for a Cyc predicate.

### populateArg2Isa

    protected void populateArg2Isa(CycConstant cycConstant)
                            throws java.net.UnknownHostException,
                                   java.io.IOException,
                                   CycApiException

  Populates the argument 2 type constaint for a Cyc predicate.

### populateArg1Format

    protected void populateArg1Format(CycConstant cycConstant)
                               throws java.net.UnknownHostException,
                                      java.io.IOException,
                                      CycApiException

  Populates the argument 1 format for a Cyc predicate.

### populateArg2Format

    protected void populateArg2Format(CycConstant cycConstant)
                               throws java.net.UnknownHostException,
                                      java.io.IOException,
                                      CycApiException

  Populates the argument 2 format for a Cyc predicate.

### populateDisjointWiths

    protected void populateDisjointWiths(CycConstant cycConstant)
                                  throws java.net.UnknownHostException,
                                         java.io.IOException,
                                         CycApiException

  Populates the disjointWiths for a Cyc collection.

### populateCoExtensionals

    protected void populateCoExtensionals(CycConstant cycConstant)
                                   throws java.net.UnknownHostException,
                                          java.io.IOException,
                                          CycApiException

  Populates the coExtensionals for a Cyc collection.

### populatePropertyAssertions

    protected void populatePropertyAssertions(CycConstant cycConstant)
                                       throws java.net.UnknownHostException,
                                              java.io.IOException,
                                              CycApiException

  Populates the non-definitional ground atomic formulas in which the the predicate is an element of the list of applicable binary predicates and in which the given term appears as the first argument.

### gatherUpwardClosure

    protected CycList gatherUpwardClosure(CycList selectedCycForts)
                                   throws java.net.UnknownHostException,
                                          java.io.IOException,
                                          CycApiException

  Gather the updward closure of the selected CycForts with regard to isas and genls for collection terms, and with regard to genlPreds for predicate terms.
  Returns:
    the updward closure of the selected CycForts with regard to genls for collection terms, and with regard to genlPreds for predicate terms

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD