001: /*****************************************************************************
002: * Source code information
003: * -----------------------
004: * Original author Ian Dickinson, HP Labs Bristol
005: * Author email ian.dickinson@hp.com
006: * Package Jena 2
007: * Web http://sourceforge.net/projects/jena/
008: * Created 22-Aug-2003
009: * Filename $RCSfile: Main.java,v $
010: * Revision $Revision: 1.1 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2005/10/06 17:49:06 $
014: * by $Author: andy_seaborne $
015: *
016: * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
017: * (see footer for full conditions)
018: *****************************************************************************/package jena.examples.ontology.describeClass;
019:
020: // Imports
021: ///////////////
022: import java.util.Iterator;
023:
024: import com.hp.hpl.jena.ontology.*;
025: import com.hp.hpl.jena.rdf.model.ModelFactory;
026:
027: /**
028: * <p>
029: * Execution wrapper for describe-class example
030: * </p>
031: *
032: * @author Ian Dickinson, HP Labs
033: * (<a href="mailto:Ian.Dickinson@hp.com" >email</a>)
034: * @version CVS $Id: Main.java,v 1.1 2005/10/06 17:49:06 andy_seaborne Exp $
035: */
036: public class Main {
037: // Constants
038: //////////////////////////////////
039:
040: // Static variables
041: //////////////////////////////////
042:
043: // Instance variables
044: //////////////////////////////////
045:
046: // Constructors
047: //////////////////////////////////
048:
049: // External signature methods
050: //////////////////////////////////
051:
052: public static void main(String[] args) {
053: // read the argument file, or the default
054: String source = (args.length == 0) ? "http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine"
055: : args[0];
056:
057: // guess if we're using a daml source
058: boolean isDAML = source.endsWith(".daml");
059:
060: OntModel m = ModelFactory.createOntologyModel(
061: isDAML ? OntModelSpec.DAML_MEM : OntModelSpec.OWL_MEM,
062: null);
063:
064: // we have a local copy of the wine ontology
065: m.getDocumentManager().addAltEntry(
066: "http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine",
067: "file:./testing/reasoners/bugs/wine.owl");
068: m.getDocumentManager().addAltEntry(
069: "http://www.w3.org/TR/2003/CR-owl-guide-20030818/food",
070: "file:./testing/reasoners/bugs/food.owl");
071:
072: // read the source document
073: m.read(source);
074:
075: DescribeClass dc = new DescribeClass();
076:
077: if (args.length >= 2) {
078: // we have a named class to describe
079: OntClass c = m.getOntClass(args[1]);
080: dc.describeClass(System.out, c);
081: } else {
082: for (Iterator i = m.listClasses(); i.hasNext();) {
083: // now list the classes
084: dc.describeClass(System.out, (OntClass) i.next());
085: }
086: }
087: }
088:
089: // Internal implementation methods
090: //////////////////////////////////
091:
092: //==============================================================================
093: // Inner class definitions
094: //==============================================================================
095:
096: }
097:
098: /*
099: (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
100: All rights reserved.
101:
102: Redistribution and use in source and binary forms, with or without
103: modification, are permitted provided that the following conditions
104: are met:
105:
106: 1. Redistributions of source code must retain the above copyright
107: notice, this list of conditions and the following disclaimer.
108:
109: 2. Redistributions in binary form must reproduce the above copyright
110: notice, this list of conditions and the following disclaimer in the
111: documentation and/or other materials provided with the distribution.
112:
113: 3. The name of the author may not be used to endorse or promote products
114: derived from this software without specific prior written permission.
115:
116: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
117: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
119: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
120: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
121: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
122: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
123: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
124: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
125: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126: */
|