|
From: Elmer G. <ega...@us...> - 2004-07-28 07:17:12
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21723/src/org/javaowl/editor Modified Files: ModelEditorBean.java ResourceEditorBean.java Log Message: Fixed some TODO's in ModelEditorBean and ResourceEditorBean Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ModelEditorBean.java 28 Jul 2004 06:54:06 -0000 1.8 --- ModelEditorBean.java 28 Jul 2004 07:17:03 -0000 1.9 *************** *** 57,80 **** private OntResource[] classes; - - private OntResource[] leafClasses; private EditorReasoner ontologyReasoner; ! public ModelEditorBean(String ontology, String properties, String data, String prefix) throws IOException { ! this(new FileInputStream(ontology), new FileInputStream(properties), ! new FileInputStream(data), prefix); } ! public ModelEditorBean(InputStream ontologyIn, InputStream propertiesIn, InputStream dataIn, ! String prefix) throws IOException { this.prefix = prefix; ontology = ModelFactory.createDefaultModel(); ontology.read(ontologyIn, null, "N3"); ontologyIn.close(); - // Not supported by reasoner - // ontology.read(propertiesIn, null, "N3"); - propertiesIn.close(); ontModel = ModelFactory .createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF, ontology); --- 57,73 ---- private OntResource[] classes; private EditorReasoner ontologyReasoner; ! public ModelEditorBean(String ontology, String data, String prefix) throws IOException { ! this(new FileInputStream(ontology), new FileInputStream(data), prefix); } ! public ModelEditorBean(InputStream ontologyIn, InputStream dataIn, String prefix) throws IOException { this.prefix = prefix; ontology = ModelFactory.createDefaultModel(); ontology.read(ontologyIn, null, "N3"); ontologyIn.close(); ontModel = ModelFactory .createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF, ontology); *************** *** 86,93 **** } ! public ModelEditorBean(Model ontology, Model properties, Model data, String prefix) { this.prefix = prefix; - // Not supported by reasoner - // ontology.add(properties); this.ontology = ontology; ontModel = ModelFactory --- 79,84 ---- } ! public ModelEditorBean(Model ontology, Model data, String prefix) { this.prefix = prefix; this.ontology = ontology; ontModel = ModelFactory *************** *** 102,109 **** } - public OntResource[] getLeafClasses() { - return leafClasses; - } - public Set getPropertiesURIs(Resource clazz, boolean all) { List l = new ArrayList(); --- 93,96 ---- *************** *** 136,141 **** return result; } ! //TODO: rename getAllDatatypeProperties ! public OntProperty[] getAllProperties() { Set props = new HashSet(); for (Iterator it = ontModel.listDatatypeProperties(); it.hasNext();) { --- 123,128 ---- return result; } ! ! public OntProperty[] getAllDatatypeProperties() { Set props = new HashSet(); for (Iterator it = ontModel.listDatatypeProperties(); it.hasNext();) { *************** *** 170,188 **** } ! //TODO: rename getOntClass etc ... ! public OntClass createClass(Resource resource) { return ontModel.createClass(resource.getURI()); } ! public OntProperty createProperty(Property property) { return ontModel.createOntProperty(property.getURI()); } ! public Literal createTypedLiteral(Object value, OntResource type) { return data.createTypedLiteral(value, type.getURI()); } public void removeStatement(Statement statement) { - ontModel.remove(statement); // TODO: Do we really need this? data.remove(statement); } --- 157,174 ---- } ! ! public OntClass getOntClass(Resource resource) { return ontModel.createClass(resource.getURI()); } ! public OntProperty getOntProperty(Property property) { return ontModel.createOntProperty(property.getURI()); } ! public Literal getTypedLiteral(Object value, OntResource type) { return data.createTypedLiteral(value, type.getURI()); } public void removeStatement(Statement statement) { data.remove(statement); } *************** *** 193,197 **** for(Iterator it = resource.listProperties(); it.hasNext(); ) stmts.add(it.next()); - ontModel.remove(stmts); data.remove(stmts); } --- 179,182 ---- *************** *** 207,212 **** return (OntClass[]) classes.toArray(new OntClass[0]); } ! //TODO: look for better names ! public ResourceEditorBean getNewResourceEditor(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); --- 192,197 ---- return (OntClass[]) classes.toArray(new OntClass[0]); } ! ! public ResourceEditorBean createResource(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); *************** *** 214,218 **** } ! public ResourceEditorBean getNewResourceEditor(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); --- 199,203 ---- } ! public ResourceEditorBean createResource(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); *************** *** 220,224 **** } ! public ResourceEditorBean getResourceEditor(Resource resource) { return new ResourceEditorBean(resource, prefix, ontModel, this); } --- 205,209 ---- } ! public ResourceEditorBean getResource(Resource resource) { return new ResourceEditorBean(resource, prefix, ontModel, this); } *************** *** 241,247 **** throw new RuntimeException("ontology reasoner exception: ", e); } - //TODO: Remove leafClasses methods List classes = new ArrayList(); - List leafClasses = new ArrayList(); for (Iterator it = ontModel.listNamedClasses(); it.hasNext();) { OntResource or = (OntResource) it.next(); --- 226,230 ---- *************** *** 249,262 **** if (prefix == null || oc.getNameSpace().equals(prefix)) { classes.add(or); - boolean isLeaf = true; - Iterator it2 = oc.listSubClasses(); - if (it2.hasNext()) - isLeaf = false; - if (isLeaf) - leafClasses.add(or); } } this.classes = (OntResource[]) classes.toArray(new OntResource[0]); - this.leafClasses = (OntResource[]) leafClasses.toArray(new OntResource[0]); } } --- 232,238 ---- Index: ResourceEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ResourceEditorBean.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ResourceEditorBean.java 28 Jul 2004 06:54:06 -0000 1.5 --- ResourceEditorBean.java 28 Jul 2004 07:17:03 -0000 1.6 *************** *** 92,97 **** return result; } ! //TODO: rename getDeclaredPRoperties ! public Statement[] getProperties() { List resources = new ArrayList(); for (Iterator it = resource.listProperties(); it.hasNext();) { --- 92,97 ---- return result; } ! ! public Statement[] getDeclaredProperties() { List resources = new ArrayList(); for (Iterator it = resource.listProperties(); it.hasNext();) { *************** *** 106,109 **** --- 106,110 ---- return false; } + //TODO: get all valid Instances for the range intersection and the // resource restrictions |