|
From: Elmer G. <ega...@us...> - 2004-08-19 21:28:04
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26693/src/org/javaowl/editor Modified Files: ModelEditorBean.java ModelEditor.java ResourceEditorBean.java Log Message: Removed all references to ResourceEditorBean Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ModelEditorBean.java 19 Aug 2004 14:45:22 -0000 1.12 --- ModelEditorBean.java 19 Aug 2004 21:27:54 -0000 1.13 *************** *** 32,35 **** --- 32,36 ---- import org.javaowl.editor.reasoner.EditorReasoner; + import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; *************** *** 46,49 **** --- 47,51 ---- import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.vocabulary.RDF; + import com.hp.hpl.jena.vocabulary.RDFS; import com.hp.hpl.jena.vocabulary.XSD; *************** *** 211,214 **** --- 213,235 ---- } + public Individual[] getValidObjects(OntResource resource) { + List resources = new ArrayList(); + OntClass oc = resource.asClass(); + for (Iterator it = oc.listInstances(); it.hasNext();) + resources.add(it.next()); + + return (Individual[]) resources.toArray(new Individual[0]); + } + + public Statement addObjectValue(Resource resource, Property property, Resource value) { + resource.addProperty(property, value); + return resource.getProperty(property); // TODO: This is a BUG! + } + + public Statement addDataValue(Resource resource, Property property, Literal value) { + resource.addProperty(property, value); + return resource.getProperty(property); // TODO: This is a BUG! + } + public InstanceClassification getInstanceClassification(Resource instance) { EditorReasoner reasoner = new EditorReasoner(); *************** *** 274,305 **** } ! public ResourceEditorBean createResourceEditor(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); ! return new ResourceEditorBean(r, prefix, ontModel); } ! public ResourceEditorBean createResourceEditor(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); ! return new ResourceEditorBean(r, prefix, ontModel); } ! public ResourceEditorBean getResourceEditor(Resource resource) { ! return new ResourceEditorBean(resource, prefix, ontModel); } ! public Resource createResource(OntResource classResource) { ! Resource r = data.createResource(); ! r.addProperty(RDF.type, classResource); ! return r; } ! public Resource createResource(String uri, OntResource classResource) { ! Resource r = data.createResource(uri); ! r.addProperty(RDF.type, classResource); ! return r; } private void init() { ontologyReasoner = new EditorReasoner(); --- 295,337 ---- } ! public Resource createResource(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); ! return r; } ! public Resource createResource(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); ! return r; } ! ! public String getLabel(Resource resource) { ! Statement s = resource.getProperty(RDFS.label); ! return s == null ? "" : s.getString(); } ! public void setLabel(Resource resource, String label) { ! if (testEmpty(label)) ! return; ! resource.addProperty(RDFS.label, label); } ! public String getComment(Resource resource) { ! Statement s = resource.getProperty(RDFS.comment); ! return s == null ? "" : s.getString(); } + public void setComment(Resource resource, String comment) { + if (testEmpty(comment)) + return; + resource.addProperty(RDFS.comment, comment); + } + + private boolean testEmpty(String test) { + return test == null || test.length() == 0; + } + private void init() { ontologyReasoner = new EditorReasoner(); Index: ModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditor.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ModelEditor.java 19 Aug 2004 14:45:31 -0000 1.25 --- ModelEditor.java 19 Aug 2004 21:27:54 -0000 1.26 *************** *** 21,24 **** --- 21,25 ---- + import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntProperty; *************** *** 50,59 **** public OntClass[] getSubClasses(OntClass resourceClass); - - public ResourceEditorBean createResourceEditor(OntResource classResource); - - public ResourceEditorBean createResourceEditor(String uri, OntResource classResource); - - public ResourceEditorBean getResourceEditor(Resource resource); public Resource createResource(OntResource classResource); --- 51,54 ---- *************** *** 65,67 **** --- 60,77 ---- public Statement[] getDeclaredProperties(Resource resource); + public OntResource getValidLeafClass(Property currentProperty); + + public Individual[] getValidObjects(OntResource ontClass); + + public Statement addDataValue(Resource resource, Property currentProperty, Literal typedLiteral); + + public Statement addObjectValue(Resource resource, Property currentProperty, Resource value); + + public String getLabel(Resource resource); + + public void setLabel(Resource currentResource, String label); + + public String getComment(Resource resource); + + public void setComment(Resource currentResource, String comment); } Index: ResourceEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ResourceEditorBean.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ResourceEditorBean.java 19 Aug 2004 14:45:31 -0000 1.8 --- ResourceEditorBean.java 19 Aug 2004 21:27:54 -0000 1.9 *************** *** 20,53 **** package org.javaowl.editor; - import java.util.ArrayList; - import java.util.Iterator; - import java.util.List; - - import com.hp.hpl.jena.ontology.Individual; - import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntProperty; - import com.hp.hpl.jena.ontology.OntResource; - import com.hp.hpl.jena.rdf.model.Literal; - import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; - import com.hp.hpl.jena.rdf.model.Statement; - import com.hp.hpl.jena.vocabulary.RDFS; - import com.hp.hpl.jena.vocabulary.XSD; public class ResourceEditorBean { ! private final Resource resource; ! ! private final String prefix; ! ! private final OntModel ontModel; ! ! ! public ResourceEditorBean(Resource resource, String prefix, OntModel ontModel) { ! this.prefix = prefix; ! this.resource = resource; ! this.ontModel = ontModel; ! /*InstanceClassification ic = getInstanceClassification(resource); for (Iterator it = ic.possibleIterator(); it.hasNext(); ) { --- 20,30 ---- package org.javaowl.editor; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.rdf.model.Resource; public class ResourceEditorBean { ! public ResourceEditorBean(Resource resource, String prefix, OntModel ontModel) { /*InstanceClassification ic = getInstanceClassification(resource); for (Iterator it = ic.possibleIterator(); it.hasNext(); ) { *************** *** 58,122 **** }*/ } - - public Resource getResource() { - return resource; - } public boolean isRequiredProperty(OntProperty property) { return false; } ! ! public Individual[] getValidObjects(OntResource resource) { ! List resources = new ArrayList(); ! OntClass oc = resource.asClass(); ! for (Iterator it = oc.listInstances(); it.hasNext();) ! resources.add(it.next()); ! ! return (Individual[]) resources.toArray(new Individual[0]); ! } ! public boolean isValidDataValue(OntProperty property, String value) { return false; } - public Statement addObjectValue(Property property, Resource value) { - resource.addProperty(property, value); - return resource.getProperty(property); // TODO: This is a BUG! - } - - public Statement addDataValue(Property property, Literal value) { - resource.addProperty(property, value); - return resource.getProperty(property); // TODO: This is a BUG! - } - - public String getLabel() { - Statement s = resource.getProperty(RDFS.label); - return s == null ? "" : s.getString(); - } - - public void setLabel(String label) { - if (testEmpty(label)) - return; - resource.addProperty(RDFS.label, label); - } - - public String getComment() { - Statement s = resource.getProperty(RDFS.comment); - return s == null ? "" : s.getString(); - } - - public void setComment(String comment) { - if (testEmpty(comment)) - return; - resource.addProperty(RDFS.comment, comment); - } - - public String toString() { - return resource.getURI(); - } - - private boolean testEmpty(String test) { - return test == null || test.length() == 0; - } } --- 35,47 ---- }*/ } public boolean isRequiredProperty(OntProperty property) { return false; } ! public boolean isValidDataValue(OntProperty property, String value) { return false; } } |