|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.xml.GatherOpenDirectoryTitles
Gathers Open Directory Titles and constructs a dictionary associating topic resource IDs with their titles.
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.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
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 |
GatherOpenDirectoryTitles.DamlTermInfo
Records the DAML term information for Cyc import. |
Field Summary | |
protected com.hp.hpl.jena.rdf.arp.ARP |
arp
Another RDF Parser instance. |
protected CycFort |
damlOntologyDefiningURL
URL which defines the imported daml ontology |
protected java.lang.String |
damlOntologyDefiningURLString
URL string which defines the imported daml ontology |
static int |
DEFAULT_VERBOSITY
The default verbosity of this application. |
java.util.HashMap |
odpTitles
Dictionary of category identifiers and Open Directory topic strings. |
protected java.util.HashMap |
ontologyNicknames
Ontology library nicknames, which become namespace identifiers upon import into Cyc. |
protected GatherOpenDirectoryTitles.DamlTermInfo |
previousDamlTermInfo
Previously imported term used to avoid redundant assertions. |
protected int |
verbosity
Sets verbosity of this application. |
Constructor Summary | |
GatherOpenDirectoryTitles(java.util.HashMap ontologyNicknames)
Constructs a new GatherOpenDirectoryTitles object. |
Method Summary | |
protected void |
displayTriple(GatherOpenDirectoryTitles.DamlTermInfo subjectTermInfo,
GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo,
GatherOpenDirectoryTitles.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 |
examineTriple(GatherOpenDirectoryTitles.DamlTermInfo subjectTermInfo,
GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo,
GatherOpenDirectoryTitles.DamlTermInfo objLitTermInfo)
Examines the RDF triple and gathers the topic titles. |
protected void |
gatherTitles(java.lang.String damlOntologyDefiningURLString)
Parses and imports the given DAML URL. |
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 boolean |
isProbableUri(java.lang.String string)
Returns true if the given string is likely to be a URI. |
protected GatherOpenDirectoryTitles.DamlTermInfo |
literal(com.hp.hpl.jena.rdf.arp.ALiteral literal)
Returns the DamlTerm info of the given RDF literal. |
protected GatherOpenDirectoryTitles.DamlTermInfo |
resource(com.hp.hpl.jena.rdf.arp.AResource aResource,
GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo)
Returns the DamlTerm info of the given RDF resource. |
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 |
public static final int DEFAULT_VERBOSITY
protected int verbosity
protected com.hp.hpl.jena.rdf.arp.ARP arp
protected java.util.HashMap ontologyNicknames
protected GatherOpenDirectoryTitles.DamlTermInfo previousDamlTermInfo
protected java.lang.String damlOntologyDefiningURLString
protected CycFort damlOntologyDefiningURL
public java.util.HashMap odpTitles
Constructor Detail |
public GatherOpenDirectoryTitles(java.util.HashMap ontologyNicknames)
cycAccess
- the CycAccess instance which manages the connection
to the Cyc server and provides Cyc API servicesontologyNicknames
- the dictionary associating each ontology uri with
the nickname used for the Cyc namespace qualifierMethod Detail |
protected void gatherTitles(java.lang.String damlOntologyDefiningURLString) throws java.io.IOException
damlOntologyDefiningURLString
- the URL to importimportMtName
- the microtheory into which DAML content is assertedpublic 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)
statement
in interface com.hp.hpl.jena.rdf.arp.StatementHandler
subject
- the RDF Triple Subjectpredicate
- the RDF Triple Predicateobject
- the RDF Triple Objectpublic 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)
statement
in interface com.hp.hpl.jena.rdf.arp.StatementHandler
subject
- the RDF Triple Subjectpredicate
- the RDF Triple Predicateliteral
- the RDF Triple Literalprotected void examineTriple(GatherOpenDirectoryTitles.DamlTermInfo subjectTermInfo, GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo, GatherOpenDirectoryTitles.DamlTermInfo objLitTermInfo) throws java.io.IOException, java.net.UnknownHostException, CycApiException
subjectTermInfo
- the subject DamlTermInfo objectpredicateTermInfo
- the predicate DamlTermInfo objectobjLitTermInfo
- the object or literal DamlTermInfo objectprotected java.lang.String escaped(java.lang.String text)
string
- the given stringprotected void displayTriple(GatherOpenDirectoryTitles.DamlTermInfo subjectTermInfo, GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo, GatherOpenDirectoryTitles.DamlTermInfo objLitTermInfo)
subjectTermInfo
- the subject DamlTermInfo objectpredicateTermInfo
- the predicate DamlTermInfo objectobjLitTermInfo
- the object or literal DamlTermInfo objectprotected GatherOpenDirectoryTitles.DamlTermInfo resource(com.hp.hpl.jena.rdf.arp.AResource aResource, GatherOpenDirectoryTitles.DamlTermInfo predicateTermInfo)
aResource
- the RDF resourcepredicateTermInfo
- when processing the RDF triple object,
contains the predicate term info, otherwise is null;protected GatherOpenDirectoryTitles.DamlTermInfo literal(com.hp.hpl.jena.rdf.arp.ALiteral literal)
literal
- the RDF literalprotected boolean isProbableUri(java.lang.String string)
string
- the given stringprotected boolean hasUriNamespaceSyntax(java.lang.String uri)
uri
- the URIprotected java.lang.String getOntologyNickname(java.lang.String nameSpace, com.hp.hpl.mesa.rdf.jena.model.Resource resource)
nameSpace
- the XML namespace for which the nickname is soughtresource
- the resource containing the namespace, used for error messagesprotected com.hp.hpl.mesa.rdf.jena.model.Resource translateResource(com.hp.hpl.jena.rdf.arp.AResource aResource)
aResource
- The ARP resource.public void setVerbosity(int verbosity)
verbosity
- 0 --> quiet ... 9 -> maximum diagnostic input
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |