|
From: Elmer G. <ega...@us...> - 2004-08-20 18:16:55
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25413/src/org/javaowl/editor/remote Modified Files: RemoteModelEditor.java RemoteModelEditorWrapper.java Log Message: Remote model Index: RemoteModelEditorWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditorWrapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RemoteModelEditorWrapper.java 19 Aug 2004 21:27:54 -0000 1.4 --- RemoteModelEditorWrapper.java 20 Aug 2004 18:16:44 -0000 1.5 *************** *** 31,45 **** import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; public class RemoteModelEditorWrapper implements ModelEditor { - - private RemoteModelEditor remote; private String name; private OntModel ontModel; public RemoteModelEditorWrapper(String name, RemoteModelEditor remote) { this.remote = remote; this.name = name; } public OntClass[] getAllClasses() { --- 31,66 ---- import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; + import com.hp.hpl.jena.vocabulary.RDF; public class RemoteModelEditorWrapper implements ModelEditor { private String name; private OntModel ontModel; + private RemoteModelEditor remote; + public RemoteModelEditorWrapper(String name, RemoteModelEditor remote) { this.remote = remote; this.name = name; } + + public Statement addDataValue(Resource resource, Property currentProperty, Literal typedLiteral) { + // TODO Auto-generated method stub + return null; + } + + public Statement addObjectValue(Resource resource, Property currentProperty, Resource value) { + // TODO Auto-generated method stub + return null; + } + + public Resource createResource(Resource classResource) { + Resource resource = ontModel.createResource(remote.createResource(classResource.getURI())); + return resource.addProperty(RDF.type, classResource); + } + + public Resource createResource(String uri, Resource classResource) { + Resource resource = ontModel.createResource(remote.createResource(uri, classResource.getURI())); + return resource.addProperty(RDF.type, classResource); + } public OntClass[] getAllClasses() { *************** *** 47,55 **** return createOntClassesFromUri(uris); } - - public OntClass[] getSubClasses(OntClass resourceClass) { - String[] uris = remote.getSubClasses(resourceClass.getURI()); - return createOntClassesFromUri(uris); - } public OntProperty[] getAllDatatypeProperties() { --- 68,71 ---- *************** *** 58,65 **** } ! public OntProperty[] getProperties(Resource clazz, boolean all) { ! String[] uris = remote.getProperties(clazz.getURI(), all); return createOntPropertiesFromURIs(uris); } public Resource[] getInstances(Resource clazz, boolean all) { --- 74,89 ---- } ! public OntProperty[] getApplicableProperties(Resource resource) { ! String[] uris = remote.getApplicableProperties(resource.getURI()); return createOntPropertiesFromURIs(uris); } + + public String getComment(Resource resource) { + return remote.getComment(resource.getURI()); + } + public Statement[] getDeclaredProperties(Resource resource) { + // TODO Auto-generated method stub + return null; + } public Resource[] getInstances(Resource clazz, boolean all) { *************** *** 71,74 **** --- 95,102 ---- } + public String getLabel(Resource resource) { + return remote.getLabel(resource.getURI()); + } + public OntClass getOntClass(Resource resource) { return ontModel.createClass(resource.getURI()); *************** *** 79,89 **** } public Literal getTypedLiteral(Object value, OntResource type) { return ontModel.createTypedLiteral(value, type.getURI()); } ! public void removeStatement(Statement statement) { ! remote.removeStatement(new SerializableTriple(statement.asTriple())); ! } public void removeResource(Resource resource) { --- 107,137 ---- } + public OntProperty[] getProperties(Resource clazz, boolean all) { + String[] uris = remote.getProperties(clazz.getURI(), all); + return createOntPropertiesFromURIs(uris); + } + + public OntClass[] getSubClasses(OntClass resourceClass) { + String[] uris = remote.getSubClasses(resourceClass.getURI()); + return createOntClassesFromUri(uris); + } + public Literal getTypedLiteral(Object value, OntResource type) { return ontModel.createTypedLiteral(value, type.getURI()); } ! public OntClass getValidLeafClass(Property currentProperty) { ! String uri = remote.getValidLeafClass(currentProperty.getURI()); ! return ontModel.createClass(uri); ! } ! ! public Individual[] getValidObjects(OntClass ontClass) { ! String[] uris = remote.getValidObjects(ontClass.getURI()); ! Individual[] individuals = new Individual[uris.length/2]; ! for (int i = 0; i < uris.length; i+=2) ! individuals[i] = ontModel.createIndividual(uris[i], ! ontModel.createResource(uris[i+1])); ! return individuals; ! } public void removeResource(Resource resource) { *************** *** 91,95 **** } ! private OntClass[] createOntClassesFromUri(String[] uris) { OntClass[] classes = new OntClass[uris.length]; --- 139,155 ---- } ! ! public void removeStatement(Statement statement) { ! remote.removeStatement(new SerializableTriple(statement.asTriple())); ! } ! ! public void setComment(Resource resource, String comment) { ! remote.setComment(resource.getURI(), comment); ! } ! ! public void setLabel(Resource resource, String label) { ! remote.setLabel(resource.getURI(), label); ! } ! private OntClass[] createOntClassesFromUri(String[] uris) { OntClass[] classes = new OntClass[uris.length]; *************** *** 105,181 **** return properties; } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getApplicableProperties(com.hp.hpl.jena.rdf.model.Resource) ! */ ! public OntProperty[] getApplicableProperties(Resource resource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#createResource(com.hp.hpl.jena.ontology.OntResource) ! */ ! public Resource createResource(OntResource classResource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#createResource(java.lang.String, com.hp.hpl.jena.ontology.OntResource) ! */ ! public Resource createResource(String uri, OntResource classResource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getDeclaredProperties(com.hp.hpl.jena.rdf.model.Resource) ! */ ! public Statement[] getDeclaredProperties(Resource resource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public OntResource getValidLeafClass(Property currentProperty) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public Individual[] getValidObjects(OntResource ontClass) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public Statement addDataValue(Resource resource, Property currentProperty, Literal typedLiteral) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public Statement addObjectValue(Resource resource, Property currentProperty, Resource value) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public String getLabel(Resource resource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public void setLabel(Resource currentResource, String label) { ! // TODO Auto-generated method stub ! ! } ! ! public String getComment(Resource resource) { ! // TODO Auto-generated method stub ! return null; ! } ! ! public void setComment(Resource currentResource, String comment) { ! // TODO Auto-generated method stub ! ! } ! ! } --- 165,168 ---- return properties; } ! } Index: RemoteModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RemoteModelEditor.java 19 Aug 2004 14:45:32 -0000 1.3 --- RemoteModelEditor.java 20 Aug 2004 18:16:44 -0000 1.4 *************** *** 22,66 **** import java.rmi.Remote; public interface RemoteModelEditor extends Remote{ - /** - * @return - */ String[] getAllClasses(); - /** - * @return - */ String[] getAllDatatypeProperties(); - /** - * @param uri - * @param all - * @return - */ String[] getProperties(String uri, boolean all); - /** - * @param uri - */ void removeResource(String uri); - /** - * @param uri - * @param all - * @return - */ String[] getInstances(String uri, boolean all); - /** - * @param uri - * @return - */ String[] getSubClasses(String uri); - /** - * @param triple - */ void removeStatement(SerializableTriple triple); } --- 22,60 ---- import java.rmi.Remote; + import com.hp.hpl.jena.rdf.model.Property; + public interface RemoteModelEditor extends Remote{ String[] getAllClasses(); String[] getAllDatatypeProperties(); String[] getProperties(String uri, boolean all); void removeResource(String uri); String[] getInstances(String uri, boolean all); String[] getSubClasses(String uri); void removeStatement(SerializableTriple triple); + String[] getApplicableProperties(String uri); + + String getComment(String uri); + + String getLabel(String uri); + + void setComment(String uri, String comment); + + void setLabel(String uri, String label); + + String createResource(String uri, String resourceClass); + + String createResource(String resourceClass); + + String[] getValidObjects(String uri); + + String getValidLeafClass(String currentProperty); + } |