You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(32) |
Aug
(65) |
Sep
(15) |
Oct
(35) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/editor/swing Modified Files: LabelListCellRenderer.java BrowsePage.java OntTreePagelet.java PropertyEditorPagelet.java EditPage.java Editor.java Util.java Log Message: Moe work on refactoring Index: OntTreePagelet.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/OntTreePagelet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** OntTreePagelet.java 19 Aug 2004 14:45:31 -0000 1.6 --- OntTreePagelet.java 21 Aug 2004 00:22:48 -0000 1.7 *************** *** 34,44 **** import org.javaowl.editor.ModelEditor; import com.hp.hpl.jena.ontology.OntClass; - import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Property; - import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.OWL; - import com.hp.hpl.jena.vocabulary.RDFS; public class OntTreePagelet implements Pagelet { --- 34,42 ---- import org.javaowl.editor.ModelEditor; + import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.vocabulary.OWL; public class OntTreePagelet implements Pagelet { *************** *** 77,85 **** .getLastSelectedPathComponent(); if (node != null) { ! OntResource resource = (OntResource) node.getUserObject(); if (e.getClickCount() == 2) { notifyCreateResource(resource); } else { ! notifySetResource(resource); } } --- 75,83 ---- .getLastSelectedPathComponent(); if (node != null) { ! OntClass resource = (OntClass) node.getUserObject(); if (e.getClickCount() == 2) { notifyCreateResource(resource); } else { ! notifySetClass(resource); } } *************** *** 98,103 **** setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof Resource) { ! setText(Util.getPropertyValue((Resource) value, RDFS.label, true)); setToolTipText(value.toString()); } else --- 96,101 ---- setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof ResourceEditorBean) { ! setText(((ResourceEditorBean) value).getLabel(true)); setToolTipText(value.toString()); } else *************** *** 121,130 **** } ! private void notifyCreateResource(OntResource resource) { ! browsePage.notifyCreateResource(resource); } ! private void notifySetResource(OntResource resource) { ! browsePage.setResource(resource); } --- 119,128 ---- } ! private void notifyCreateResource(OntClass clazz) { ! browsePage.notifyCreateResource(clazz); } ! private void notifySetClass(OntClass clazz) { ! browsePage.setClass(clazz); } Index: BrowsePage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/BrowsePage.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BrowsePage.java 20 Aug 2004 18:16:43 -0000 1.7 --- BrowsePage.java 21 Aug 2004 00:22:48 -0000 1.8 *************** *** 39,45 **** import org.javaowl.editor.ModelEditor; ! import com.hp.hpl.jena.ontology.OntResource; ! import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.vocabulary.RDFS; --- 39,45 ---- import org.javaowl.editor.ModelEditor; + import org.javaowl.editor.ResourceEditorBean; ! import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.vocabulary.RDFS; *************** *** 66,70 **** private final OntTreePagelet tree; ! private OntResource resource; public BrowsePage(ModelEditor editor, Editor e) { --- 66,70 ---- private final OntTreePagelet tree; ! private OntClass clazz; public BrowsePage(ModelEditor editor, Editor e) { *************** *** 86,90 **** if (e.getClickCount() == 2) { int index = instancesList.locationToIndex(e.getPoint()); ! Resource resource = (Resource) instances.elementAt(index); notifyEditResource(resource); } --- 86,90 ---- if (e.getClickCount() == 2) { int index = instancesList.locationToIndex(e.getPoint()); ! ResourceEditorBean resource = (ResourceEditorBean) instances.elementAt(index); notifyEditResource(resource); } *************** *** 95,100 **** public void keyReleased(KeyEvent e) { if (KeyEvent.VK_DELETE == e.getKeyCode()) { ! Resource resource = (Resource) instancesList ! .getSelectedValue(); instances.removeElement(resource); notifyRemoveResource(resource); --- 95,99 ---- public void keyReleased(KeyEvent e) { if (KeyEvent.VK_DELETE == e.getKeyCode()) { ! ResourceEditorBean resource = (ResourceEditorBean) instancesList.getSelectedValue(); instances.removeElement(resource); notifyRemoveResource(resource); *************** *** 126,138 **** } ! public void notifyCreateResource(OntResource resource) { e.createResource(resource); } ! private void notifyEditResource(Resource resource) { e.editResource(resource); } ! private void notifyRemoveResource(Resource resource) { editor.removeResource(resource); } --- 125,137 ---- } ! public void notifyCreateResource(OntClass resource) { e.createResource(resource); } ! private void notifyEditResource(ResourceEditorBean resource) { e.editResource(resource); } ! private void notifyRemoveResource(ResourceEditorBean resource) { editor.removeResource(resource); } *************** *** 146,151 **** } ! public void setResource(OntResource resource) { ! this.resource = resource; refresh(); } --- 145,150 ---- } ! public void setClass(OntClass clazz) { ! this.clazz = clazz; refresh(); } *************** *** 159,167 **** public void refresh() { Util.setList(resources, editor.getAllClasses()); ! if (resource != null) { ! Util.setList(properties, editor.getProperties(resource, ! allProperties.isSelected())); ! Util.setList(instances, editor.getInstances(resource, allInstances ! .isSelected())); } notifySetStatus(); --- 158,164 ---- public void refresh() { Util.setList(resources, editor.getAllClasses()); ! if (clazz != null) { ! Util.setList(properties, editor.getProperties(clazz, allProperties.isSelected())); ! Util.setList(instances, editor.getInstances(clazz, allInstances.isSelected())); } notifySetStatus(); *************** *** 169,174 **** private String getStatus() { ! return (resource != null) ? Util.getPropertyValue(resource, RDFS.label, ! true) : null; } --- 166,170 ---- private String getStatus() { ! return (clazz != null) ? editor.getPropertyValue(clazz, RDFS.label, true) : null; } Index: Util.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/Util.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Util.java 22 Jul 2004 18:28:38 -0000 1.4 --- Util.java 21 Aug 2004 00:22:48 -0000 1.5 *************** *** 24,31 **** import javax.swing.DefaultListModel; - import com.hp.hpl.jena.rdf.model.Property; - import com.hp.hpl.jena.rdf.model.Resource; - import com.hp.hpl.jena.rdf.model.Statement; - public class Util { --- 24,27 ---- *************** *** 34,44 **** } - public static String getPropertyValue(Resource r, Property p, boolean showUri) { - Statement s = r.getProperty(p); - if (s != null) - return s.getString(); - return showUri ? r.toString() : null; - } - public static void setList(DefaultListModel dlm, Object[] o) { dlm.clear(); --- 30,33 ---- Index: EditPage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/EditPage.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EditPage.java 20 Aug 2004 18:16:44 -0000 1.8 --- EditPage.java 21 Aug 2004 00:22:48 -0000 1.9 *************** *** 46,49 **** --- 46,50 ---- import org.javaowl.editor.ModelEditor; + import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.Individual; *************** *** 55,59 **** import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; - import com.hp.hpl.jena.vocabulary.RDFS; public class EditPage implements Page { --- 56,59 ---- *************** *** 79,85 **** private Editor e; ! private Resource resource; ! public EditPage(ModelEditor editor, Map propertyEditors, Editor e, Resource resource) { this.editor = editor; this.e = e; --- 79,85 ---- private Editor e; ! private ResourceEditorBean resource; ! public EditPage(ModelEditor editor, Map propertyEditors, Editor e, ResourceEditorBean resource) { this.editor = editor; this.e = e; *************** *** 141,148 **** setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof Resource) { ! setText(Util.getPropertyValue((Resource) value, RDFS.label, true)); ! setToolTipText(Util ! .getPropertyValue((Resource) value, RDFS.comment, false)); } else if (value instanceof Literal) { Literal literal = (Literal) value; --- 141,147 ---- setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof ResourceEditorBean) { ! setText(((ResourceEditorBean) value).getLabel(true)); ! setToolTipText(((ResourceEditorBean) value).getComment(false)); } else if (value instanceof Literal) { Literal literal = (Literal) value; *************** *** 239,244 **** } ! public void notifyCreateResource(OntResource resource) { ! e.createResource(resource); if (currentStatement != null) { editProperty(currentStatement); --- 238,243 ---- } ! public void notifyCreateResource(OntClass clazz) { ! e.createResource(clazz); if (currentStatement != null) { editProperty(currentStatement); *************** *** 269,273 **** private String getStatus() { StringBuffer sb = new StringBuffer(); ! sb.append(editor.getLabel(resource)); sb.append(": <"); sb.append(resource.getURI()); --- 268,272 ---- private String getStatus() { StringBuffer sb = new StringBuffer(); ! sb.append(resource.getLabel(false)); sb.append(": <"); sb.append(resource.getURI()); Index: PropertyEditorPagelet.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/PropertyEditorPagelet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PropertyEditorPagelet.java 27 Jul 2004 04:10:18 -0000 1.4 --- PropertyEditorPagelet.java 21 Aug 2004 00:22:48 -0000 1.5 *************** *** 19,22 **** --- 19,23 ---- package org.javaowl.editor.swing; + import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Resource; *************** *** 24,28 **** public interface PropertyEditorPagelet extends Pagelet { ! public void setValues(Resource[] o, Resource value, OntResource resourceClass); public void setValue(String o); --- 25,29 ---- public interface PropertyEditorPagelet extends Pagelet { ! public void setValues(Resource[] o, Resource value, OntClass clazz); public void setValue(String o); Index: Editor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/Editor.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Editor.java 19 Aug 2004 21:33:42 -0000 1.28 --- Editor.java 21 Aug 2004 00:22:48 -0000 1.29 *************** *** 25,30 **** import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; - import java.io.FileInputStream; import java.io.File; import java.io.IOException; import java.util.HashMap; --- 25,30 ---- import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; + import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; *************** *** 40,50 **** import javax.swing.JTextField; - import org.javaowl.models.prevalence.PrevalentGraph; import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ModelEditorBean; import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntResource; - import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; --- 40,51 ---- import javax.swing.JTextField; import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ModelEditorBean; + import org.javaowl.editor.ResourceEditorBean; + import org.javaowl.models.prevalence.PrevalentGraph; + import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; *************** *** 118,122 **** setURIGenerator(new DefaultURIGenerator("http://www.javaowl.org/default#")); try { ! addPropertyEditor("", Class.forName("org.javaowl.editor.swing.DefaultPropertyEditorPagelet")); OntProperty[] props = editor.getAllDatatypeProperties(); for(int i = 0; i < props.length; i++) { --- 119,123 ---- setURIGenerator(new DefaultURIGenerator("http://www.javaowl.org/default#")); try { ! addPropertyEditor("", Class.forName("org.javaowl.editor.swing.pe.DefaultPropertyEditorPagelet")); OntProperty[] props = editor.getAllDatatypeProperties(); for(int i = 0; i < props.length; i++) { *************** *** 174,178 **** } ! public void editResource(Resource resource) { EditPage editPage = new EditPage(editor, panels, this, resource); addPane(editPage); --- 175,179 ---- } ! public void editResource(ResourceEditorBean resource) { EditPage editPage = new EditPage(editor, panels, this, resource); addPane(editPage); *************** *** 180,194 **** } ! public void createResource(OntResource resource) { uriChooser.show(uriGenerator, resource); String uri = uriChooser.getURI(); String label = uriChooser.getLabel(); ! Resource current; if (uri == null) { ! current = editor.createResource(resource); } else { ! current = editor.createResource(resource); } ! editor.setLabel(current, label); EditPage editPage = new EditPage(editor, panels, this, current); addPane(editPage); --- 181,195 ---- } ! public void createResource(OntClass resource) { uriChooser.show(uriGenerator, resource); String uri = uriChooser.getURI(); String label = uriChooser.getLabel(); ! ResourceEditorBean current; if (uri == null) { ! current = editor.createResourceEditor(resource); } else { ! current = editor.createResourceEditor(resource); } ! current.setLabel(label); EditPage editPage = new EditPage(editor, panels, this, current); addPane(editPage); *************** *** 238,245 **** } ! private void setText(Resource resource) { if (resource != null) { StringBuffer sb = new StringBuffer(); ! sb.append(editor.getLabel(resource)); sb.append(": <"); sb.append(resource.getURI()); --- 239,246 ---- } ! private void setText(ResourceEditorBean resource) { if (resource != null) { StringBuffer sb = new StringBuffer(); ! sb.append(resource.getLabel(true)); sb.append(": <"); sb.append(resource.getURI()); Index: LabelListCellRenderer.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/LabelListCellRenderer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LabelListCellRenderer.java 17 Jul 2004 05:39:11 -0000 1.3 --- LabelListCellRenderer.java 21 Aug 2004 00:22:48 -0000 1.4 *************** *** 24,30 **** import javax.swing.JList; import com.hp.hpl.jena.rdf.model.Property; - import com.hp.hpl.jena.rdf.model.Resource; - import com.hp.hpl.jena.vocabulary.RDFS; public class LabelListCellRenderer extends DefaultListCellRenderer { --- 24,30 ---- import javax.swing.JList; + import org.javaowl.editor.ResourceEditorBean; + import com.hp.hpl.jena.rdf.model.Property; public class LabelListCellRenderer extends DefaultListCellRenderer { *************** *** 38,44 **** setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof Resource) { ! setText(Util.getPropertyValue((Resource) value, RDFS.label, true)); ! setToolTipText(Util.getPropertyValue((Resource) value, RDFS.comment, false)); } else setText(value.toString()); --- 38,44 ---- setText(p.getLocalName()); setToolTipText(value.toString()); ! } else if (value instanceof ResourceEditorBean) { ! setText(((ResourceEditorBean) value).getLabel(true)); ! setToolTipText(((ResourceEditorBean) value).getComment(false)); } else setText(value.toString()); |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:33
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/editor/remote Modified Files: RemoteModelEditor.java SerializableTriple.java RemoteModelEditorWrapper.java Log Message: Moe work on refactoring Index: RemoteModelEditorWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditorWrapper.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RemoteModelEditorWrapper.java 20 Aug 2004 18:16:44 -0000 1.5 --- RemoteModelEditorWrapper.java 21 Aug 2004 00:22:50 -0000 1.6 *************** *** 21,24 **** --- 21,26 ---- import org.javaowl.editor.ModelEditor; + import org.javaowl.editor.ModelEditorBean; + import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.Individual; *************** *** 31,35 **** 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 { --- 33,36 ---- *************** *** 44,65 **** } ! 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); } --- 45,66 ---- } ! public Statement addDataValue(ResourceEditorBean resource, Property currentProperty, Literal typedLiteral) { // TODO Auto-generated method stub return null; } ! public Statement addObjectValue(ResourceEditorBean resource, Property currentProperty, Resource value) { // TODO Auto-generated method stub return null; } ! public ResourceEditorBean createResourceEditor(OntClass clazz) { ! Resource resource = ontModel.createResource(remote.createResource(clazz.getURI())); ! return ModelEditorBean.getResourceEditor(resource, this); } ! public ResourceEditorBean createResourceEditor(String uri, OntClass clazz) { ! Resource resource = ontModel.createResource(remote.createResource(uri, clazz.getURI())); ! return ModelEditorBean.getResourceEditor(resource, this); } *************** *** 74,99 **** } ! 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) { String[] uris = remote.getInstances(clazz.getURI(), all); ! Resource[] resources = new Resource[uris.length]; for (int i = 0; i < uris.length; i++) ! resources[i] = ontModel.createOntProperty(uris[i]); return resources; } ! public String getLabel(Resource resource) { return remote.getLabel(resource.getURI()); } --- 75,97 ---- } ! public OntProperty[] getApplicableProperties(ResourceEditorBean resource) { String[] uris = remote.getApplicableProperties(resource.getURI()); return createOntPropertiesFromURIs(uris); } ! ! public Statement[] getDeclaredProperties(ResourceEditorBean resource) { // TODO Auto-generated method stub return null; } ! public ResourceEditorBean[] getInstances(OntClass clazz, boolean all) { String[] uris = remote.getInstances(clazz.getURI(), all); ! ResourceEditorBean[] resources = new ResourceEditorBean[uris.length]; for (int i = 0; i < uris.length; i++) ! resources[i] = ModelEditorBean.getResourceEditor(ontModel.createResource(uris[i]), this); return resources; } ! public String getLabel(ResourceEditorBean resource) { return remote.getLabel(resource.getURI()); } *************** *** 107,117 **** } ! 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); } --- 105,115 ---- } ! public OntProperty[] getProperties(OntClass clazz, boolean all) { String[] uris = remote.getProperties(clazz.getURI(), all); return createOntPropertiesFromURIs(uris); } ! public OntClass[] getSubClasses(OntClass clazz) { ! String[] uris = remote.getSubClasses(clazz.getURI()); return createOntClassesFromUri(uris); } *************** *** 126,131 **** } ! 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) --- 124,129 ---- } ! public Individual[] getValidObjects(OntClass clazz) { ! String[] uris = remote.getValidObjects(clazz.getURI()); Individual[] individuals = new Individual[uris.length/2]; for (int i = 0; i < uris.length; i+=2) *************** *** 135,139 **** } ! public void removeResource(Resource resource) { remote.removeResource(resource.getURI()); --- 133,137 ---- } ! public void removeResource(ResourceEditorBean resource) { remote.removeResource(resource.getURI()); *************** *** 144,155 **** } - 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]; --- 142,145 ---- *************** *** 165,168 **** --- 155,176 ---- return properties; } + + public String getPropertyValue(ResourceEditorBean bean, Property p, boolean uri) { + // TODO Auto-generated method stub + return null; + } + + public void addPropertyValue(ResourceEditorBean bean, Property label, String value) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.javaowl.editor.ModelEditor#getPropertyValue(com.hp.hpl.jena.ontology.OntClass, com.hp.hpl.jena.rdf.model.Property, boolean) + */ + public String getPropertyValue(OntClass clazz, Property label, boolean b) { + // TODO Auto-generated method stub + return null; + } } Index: RemoteModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RemoteModelEditor.java 20 Aug 2004 18:16:44 -0000 1.4 --- RemoteModelEditor.java 21 Aug 2004 00:22:50 -0000 1.5 *************** *** 22,27 **** import java.rmi.Remote; - import com.hp.hpl.jena.rdf.model.Property; - public interface RemoteModelEditor extends Remote{ --- 22,25 ---- Index: SerializableTriple.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/SerializableTriple.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SerializableTriple.java 19 Aug 2004 14:45:32 -0000 1.1 --- SerializableTriple.java 21 Aug 2004 00:22:50 -0000 1.2 *************** *** 23,30 **** import java.io.Serializable; - import com.hp.hpl.jena.graph.Triple; - import org.javaowl.models.prevalence.TripleUtil; public class SerializableTriple implements Serializable { --- 23,30 ---- import java.io.Serializable; import org.javaowl.models.prevalence.TripleUtil; + import com.hp.hpl.jena.graph.Triple; + public class SerializableTriple implements Serializable { |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:33
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/pe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/editor/swing/pe Added Files: DefaultPropertyEditorPagelet.java StringPropertyEditorPagelet.java DurationPropertyEditorPagelet.java BooleanPropertyEditorPagelet.java NumericPropertyEditorPagelet.java CalendarPropertyEditorPagelet.java Log Message: Moe work on refactoring --- NEW FILE: StringPropertyEditorPagelet.java --- /* * StringPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextField; import org.javaowl.editor.swing.EditPage; import org.javaowl.editor.swing.PropertyEditorPagelet; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Resource; public class StringPropertyEditorPagelet implements PropertyEditorPagelet { private JTextField textField = new JTextField(30); private JPanel textPanel = new JPanel(); private final JPanel component; private EditPage editPage; private OntResource rangeType; public StringPropertyEditorPagelet() { component = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); JButton ok = new JButton("Set property"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(false); } }); buttonPanel.add(ok); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(true); } }); buttonPanel.add(cancel); textPanel.add(textField); component.add(buttonPanel, BorderLayout.SOUTH); } public void setValues(Resource[] o, Resource value, OntClass clazz) { } public void setValue(String o) { textField.setText(o); component.add(textPanel, BorderLayout.CENTER); } private void setValue(boolean cancel) { if (cancel) { editPage.cancel(); } else if (!textField.getText().equals("")) { editPage.setProperty(textField.getText(), rangeType); } else { editPage.cancel(); } } public void setRangeType(OntResource rangeType) { this.rangeType = rangeType; } public void setEditPage(EditPage editPage) { this.editPage = editPage; } public Component getComponent() { return component; } } --- NEW FILE: DurationPropertyEditorPagelet.java --- /* * DurationPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; public class DurationPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: CalendarPropertyEditorPagelet.java --- /* * CalendarPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; public class CalendarPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: NumericPropertyEditorPagelet.java --- /* * NumericPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; public class NumericPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: BooleanPropertyEditorPagelet.java --- /* * BooleanPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; public class BooleanPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: DefaultPropertyEditorPagelet.java --- /* * DefaultPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.swing.pe; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.ListCellRenderer; import org.javaowl.editor.swing.EditPage; import org.javaowl.editor.swing.LabelListCellRenderer; import org.javaowl.editor.swing.PropertyEditorPagelet; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Resource; public class DefaultPropertyEditorPagelet implements PropertyEditorPagelet { private JTextField textField = new JTextField(30); private JComboBox comboBox = new JComboBox(); private JPanel textPanel = new JPanel(); private JPanel comboPanel = new JPanel(); private OntClass clazz; private final JPanel component; private EditPage editPage; private OntResource rangeType; public DefaultPropertyEditorPagelet() { ListCellRenderer renderer = new LabelListCellRenderer(); comboBox.setRenderer(renderer); component = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); JButton ok = new JButton("Set property"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(false); } }); buttonPanel.add(ok); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(true); } }); buttonPanel.add(cancel); textPanel.add(textField); comboPanel.add(comboBox); JButton create = new JButton("Create resource"); create.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editPage.notifyCreateResource(clazz); } }); comboPanel.add(create); component.add(buttonPanel, BorderLayout.SOUTH); } public void setValues(Resource[] o, Resource value, OntClass clazz) { this.clazz = clazz; textField.setText(null); comboBox.removeAllItems(); if (o != null) { for (int i = 0; i < o.length; i++) comboBox.addItem(o[i]); } else comboBox.addItem(value); comboBox.setSelectedItem(value); component.remove(textPanel); component.add(comboPanel, BorderLayout.CENTER); } public void setValue(String o) { comboBox.removeAllItems(); textField.setText(o); component.remove(comboPanel); component.add(textPanel, BorderLayout.CENTER); } private void setValue(boolean cancel) { if (cancel) { editPage.cancel(); } else if (comboBox.getItemCount() == 0 && !textField.getText().equals("")) { editPage.setProperty(textField.getText(), rangeType); } else if (textField.getText().equals("") && comboBox.getItemCount() != 0) { editPage.setProperty((Resource) comboBox.getSelectedItem()); } else { editPage.cancel(); } } public void setRangeType(OntResource rangeType) { this.rangeType = rangeType; } public void setEditPage(EditPage editPage) { this.editPage = editPage; } public Component getComponent() { return component; } } |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:33
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/prevalence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/models/prevalence Modified Files: PrevalentGraph.java StorageGraph.java Log Message: Moe work on refactoring Index: PrevalentGraph.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/prevalence/PrevalentGraph.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PrevalentGraph.java 11 Aug 2004 02:06:04 -0000 1.5 --- PrevalentGraph.java 21 Aug 2004 00:22:51 -0000 1.6 *************** *** 26,43 **** import org.prevayler.implementation.SnapshotPrevayler; - import com.hp.hpl.jena.graph.Graph; - import com.hp.hpl.jena.graph.GraphUtil; - import com.hp.hpl.jena.graph.Triple; - import com.hp.hpl.jena.graph.Node; - import com.hp.hpl.jena.graph.TripleMatch; - import com.hp.hpl.jena.graph.TransactionHandler; import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; import com.hp.hpl.jena.graph.GraphEventManager; import com.hp.hpl.jena.graph.Reifier; ! import com.hp.hpl.jena.graph.query.QueryHandler; import com.hp.hpl.jena.shared.PrefixMapping; - import com.hp.hpl.jena.shared.AddDeniedException; - import com.hp.hpl.jena.shared.DeleteDeniedException; import com.hp.hpl.jena.util.iterator.ExtendedIterator; --- 26,43 ---- import org.prevayler.implementation.SnapshotPrevayler; import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; + import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.GraphEventManager; + import com.hp.hpl.jena.graph.GraphUtil; + import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Reifier; ! import com.hp.hpl.jena.graph.TransactionHandler; ! import com.hp.hpl.jena.graph.Triple; ! import com.hp.hpl.jena.graph.TripleMatch; ! import com.hp.hpl.jena.graph.query.QueryHandler; ! import com.hp.hpl.jena.shared.AddDeniedException; ! import com.hp.hpl.jena.shared.DeleteDeniedException; import com.hp.hpl.jena.shared.PrefixMapping; import com.hp.hpl.jena.util.iterator.ExtendedIterator; Index: StorageGraph.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/prevalence/StorageGraph.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StorageGraph.java 11 Aug 2004 02:06:04 -0000 1.4 --- StorageGraph.java 21 Aug 2004 00:22:51 -0000 1.5 *************** *** 26,50 **** import java.util.Iterator; ! import com.hp.hpl.jena.graph.Graph; ! import com.hp.hpl.jena.graph.GraphUtil; ! import com.hp.hpl.jena.graph.Triple; ! import com.hp.hpl.jena.graph.Node; ! import com.hp.hpl.jena.graph.TripleMatch; ! import com.hp.hpl.jena.graph.TransactionHandler; import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; import com.hp.hpl.jena.graph.GraphEventManager; import com.hp.hpl.jena.graph.Reifier; ! import com.hp.hpl.jena.graph.query.QueryHandler; ! import com.hp.hpl.jena.mem.GraphMem; ! import com.hp.hpl.jena.shared.ReificationStyle; import com.hp.hpl.jena.shared.PrefixMapping; ! import com.hp.hpl.jena.shared.AddDeniedException; ! import com.hp.hpl.jena.shared.DeleteDeniedException; import com.hp.hpl.jena.util.iterator.ExtendedIterator; - import org.prevayler.AlarmClock; - import org.prevayler.implementation.AbstractPrevalentSystem; - class StorageGraph extends AbstractPrevalentSystem implements Graph, Externalizable { --- 26,50 ---- import java.util.Iterator; ! import org.prevayler.AlarmClock; ! import org.prevayler.implementation.AbstractPrevalentSystem; ! import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; + import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.GraphEventManager; + import com.hp.hpl.jena.graph.GraphUtil; + import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Reifier; ! import com.hp.hpl.jena.graph.TransactionHandler; ! import com.hp.hpl.jena.graph.Triple; ! import com.hp.hpl.jena.graph.TripleMatch; ! import com.hp.hpl.jena.graph.query.QueryHandler; ! import com.hp.hpl.jena.mem.GraphMem; ! import com.hp.hpl.jena.shared.AddDeniedException; ! import com.hp.hpl.jena.shared.DeleteDeniedException; import com.hp.hpl.jena.shared.PrefixMapping; ! import com.hp.hpl.jena.shared.ReificationStyle; import com.hp.hpl.jena.util.iterator.ExtendedIterator; class StorageGraph extends AbstractPrevalentSystem implements Graph, Externalizable { |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:16
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/models/remote Modified Files: RemoteGraphWrapper.java Log Message: Moe work on refactoring Index: RemoteGraphWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraphWrapper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RemoteGraphWrapper.java 19 Aug 2004 14:45:32 -0000 1.6 --- RemoteGraphWrapper.java 21 Aug 2004 00:22:51 -0000 1.7 *************** *** 21,31 **** import java.rmi.RemoteException; - import java.util.List; import java.util.ArrayList; import java.util.Iterator; import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.GraphEventManager; import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Reifier; --- 21,36 ---- import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Iterator; + import java.util.List; + + import org.javaowl.editor.remote.SerializableTriple; + import org.javaowl.models.prevalence.TripleUtil; + import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; import com.hp.hpl.jena.graph.Graph; import com.hp.hpl.jena.graph.GraphEventManager; + import com.hp.hpl.jena.graph.GraphUtil; import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.graph.Reifier; *************** *** 39,46 **** import com.hp.hpl.jena.util.iterator.ExtendedIterator; import com.hp.hpl.jena.util.iterator.WrappedIterator; - import com.hp.hpl.jena.graph.GraphUtil; - - import org.javaowl.editor.remote.SerializableTriple; - import org.javaowl.models.prevalence.TripleUtil; public class RemoteGraphWrapper implements Graph, BulkUpdateHandler { --- 44,47 ---- |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:13
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/editor Modified Files: ResourceEditorBean.java ModelEditor.java ModelEditorBean.java Log Message: Moe work on refactoring Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ModelEditorBean.java 20 Aug 2004 18:16:43 -0000 1.14 --- ModelEditorBean.java 21 Aug 2004 00:22:49 -0000 1.15 *************** *** 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; --- 47,50 ---- *************** *** 139,145 **** } ! public OntProperty[] getApplicableProperties(Resource resource) { Set props = new HashSet(); ! InstanceClassification ic = getInstanceClassification(resource); for (Iterator iter = ic.possibleIterator(); iter.hasNext(); ) { String uri = (String) iter.next(); --- 138,144 ---- } ! public OntProperty[] getApplicableProperties(ResourceEditorBean resource) { Set props = new HashSet(); ! InstanceClassification ic = getInstanceClassification(resource.resource); for (Iterator iter = ic.possibleIterator(); iter.hasNext(); ) { String uri = (String) iter.next(); *************** *** 158,164 **** } ! public Statement[] getDeclaredProperties(Resource resource) { List resources = new ArrayList(); ! for (Iterator it = resource.listProperties(); it.hasNext();) { Statement stmt = (Statement) it.next(); if (stmt.getPredicate().getNameSpace().equals(prefix)) --- 157,163 ---- } ! public Statement[] getDeclaredProperties(ResourceEditorBean resource) { List resources = new ArrayList(); ! for (Iterator it = resource.resource.listProperties(); it.hasNext();) { Statement stmt = (Statement) it.next(); if (stmt.getPredicate().getNameSpace().equals(prefix)) *************** *** 168,172 **** } ! public OntProperty[] getProperties(Resource clazz, boolean all) { Set props = getPropertiesURIs(clazz, all); OntProperty[] result = new OntProperty[props.size()]; --- 167,171 ---- } ! public OntProperty[] getProperties(OntClass clazz, boolean all) { Set props = getPropertiesURIs(clazz, all); OntProperty[] result = new OntProperty[props.size()]; *************** *** 187,191 **** } ! public Resource[] getInstances(Resource clazz, boolean all) { List resources = new ArrayList(); if (all) { --- 186,190 ---- } ! public ResourceEditorBean[] getInstances(OntClass clazz, boolean all) { List resources = new ArrayList(); if (all) { *************** *** 203,213 **** Resource resource = it.nextResource(); if (reasoner.isType(resource, clazz)) ! resources.add(resource); } } else { for (Iterator it = data.listSubjectsWithProperty(RDF.type, clazz); it.hasNext();) ! resources.add(it.next()); } ! return (Resource[]) resources.toArray(new Resource[0]); } --- 202,212 ---- Resource resource = it.nextResource(); if (reasoner.isType(resource, clazz)) ! resources.add(new ResourceEditorBean(resource, this)); } } else { for (Iterator it = data.listSubjectsWithProperty(RDF.type, clazz); it.hasNext();) ! resources.add(new ResourceEditorBean((Resource) it.next(), this)); } ! return (ResourceEditorBean[]) resources.toArray(new ResourceEditorBean[0]); } *************** *** 221,235 **** } ! 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(); Model model = ModelFactory.createDefaultModel(); --- 220,238 ---- } ! public Statement addObjectValue(ResourceEditorBean resource, Property property, Resource value) { ! resource.resource.addProperty(property, value); ! return resource.resource.getProperty(property); // TODO: This is a BUG! } ! public Statement addDataValue(ResourceEditorBean resource, Property property, Literal value) { ! resource.resource.addProperty(property, value); ! return resource.resource.getProperty(property); // TODO: This is a BUG! ! } ! ! public void addPropertyValue(ResourceEditorBean resource, Property property, String value) { ! resource.resource.addProperty(property, value); } ! private InstanceClassification getInstanceClassification(Resource instance) { EditorReasoner reasoner = new EditorReasoner(); Model model = ModelFactory.createDefaultModel(); *************** *** 276,289 **** //TODO: remove where resource is object ! public void removeResource(Resource resource) { List stmts = new ArrayList(); ! for(Iterator it = resource.listProperties(); it.hasNext(); ) stmts.add(it.next()); data.remove(stmts); } ! public OntClass[] getSubClasses(OntClass resourceClass) { List classes = new ArrayList(); ! Vector v = ontologyReasoner.getSubClasses(resourceClass, false); for (Iterator iter = v.iterator(); iter.hasNext(); ) { String uri = iter.next().toString(); --- 279,292 ---- //TODO: remove where resource is object ! public void removeResource(ResourceEditorBean resource) { List stmts = new ArrayList(); ! for(Iterator it = resource.resource.listProperties(); it.hasNext(); ) stmts.add(it.next()); data.remove(stmts); } ! public OntClass[] getSubClasses(OntClass clazz) { List classes = new ArrayList(); ! Vector v = ontologyReasoner.getSubClasses(clazz, false); for (Iterator iter = v.iterator(); iter.hasNext(); ) { String uri = iter.next().toString(); *************** *** 294,334 **** } ! public Resource createResource(Resource classResource) { Resource r = data.createResource(); ! r.addProperty(RDF.type, classResource); ! return r; } ! public Resource createResource(String uri, Resource 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; } --- 297,330 ---- } ! public ResourceEditorBean createResourceEditor(OntClass clazz) { Resource r = data.createResource(); ! r.addProperty(RDF.type, clazz); ! return new ResourceEditorBean(r, this); } ! public static ResourceEditorBean getResourceEditor(Resource r, ModelEditor editor) { ! return new ResourceEditorBean(r, editor); } ! public ResourceEditorBean createResourceEditor(String uri, OntClass clazz) { ! Resource r = data.createResource(uri); ! r.addProperty(RDF.type, clazz); ! return new ResourceEditorBean(r, this); } ! public String getPropertyValue(ResourceEditorBean resource, Property p, boolean showUri) { ! Statement s = resource.resource.getProperty(p); ! if (s != null) ! return s.getString(); ! return showUri ? resource.toString() : null; } ! ! public String getPropertyValue(OntClass clazz, Property p, boolean showUri) { ! Statement s = clazz.getProperty(p); ! if (s != null) ! return s.getString(); ! return showUri ? clazz.toString() : null; } Index: ModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditor.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ModelEditor.java 20 Aug 2004 18:16:43 -0000 1.27 --- ModelEditor.java 21 Aug 2004 00:22:49 -0000 1.28 *************** *** 32,42 **** public interface ModelEditor { ! public Statement addDataValue(Resource resource, Property currentProperty, Literal typedLiteral); ! public Statement addObjectValue(Resource resource, Property currentProperty, Resource value); ! public Resource createResource(Resource classResource); ! public Resource createResource(String uri, Resource classResource); public OntClass[] getAllClasses(); --- 32,44 ---- public interface ModelEditor { ! public Statement addDataValue(ResourceEditorBean resource, Property currentProperty, Literal typedLiteral); ! public Statement addObjectValue(ResourceEditorBean resource, Property currentProperty, Resource value); ! ! public void addPropertyValue(ResourceEditorBean bean, Property label, String value); ! public ResourceEditorBean createResourceEditor(OntClass clazz); ! public ResourceEditorBean createResourceEditor(String uri, OntClass clazz); public OntClass[] getAllClasses(); *************** *** 44,56 **** public OntProperty[] getAllDatatypeProperties(); ! public OntProperty[] getApplicableProperties(Resource resource); ! ! public String getComment(Resource resource); ! ! public Statement[] getDeclaredProperties(Resource resource); ! public Resource[] getInstances(Resource clazz, boolean all); ! public String getLabel(Resource resource); public OntClass getOntClass(Resource resource); --- 46,54 ---- public OntProperty[] getAllDatatypeProperties(); ! public OntProperty[] getApplicableProperties(ResourceEditorBean resource); ! public Statement[] getDeclaredProperties(ResourceEditorBean resource); ! public ResourceEditorBean[] getInstances(OntClass clazz, boolean all); public OntClass getOntClass(Resource resource); *************** *** 58,64 **** public OntProperty getOntProperty(Property property); ! public OntProperty[] getProperties(Resource clazz, boolean all); ! public OntClass[] getSubClasses(OntClass resourceClass); public Literal getTypedLiteral(Object value, OntResource type); --- 56,66 ---- public OntProperty getOntProperty(Property property); ! public OntProperty[] getProperties(OntClass clazz, boolean all); ! ! public String getPropertyValue(OntClass clazz, Property label, boolean b); ! ! public String getPropertyValue(ResourceEditorBean bean, Property p, boolean uri); ! public OntClass[] getSubClasses(OntClass clazz); public Literal getTypedLiteral(Object value, OntResource type); *************** *** 66,77 **** public OntClass getValidLeafClass(Property currentProperty); ! public Individual[] getValidObjects(OntClass ontClass); ! public void removeResource(Resource resource); public void removeStatement(Statement statement); - - public void setComment(Resource resource, String comment); - - public void setLabel(Resource resource, String label); } --- 68,75 ---- public OntClass getValidLeafClass(Property currentProperty); ! public Individual[] getValidObjects(OntClass clazz); ! public void removeResource(ResourceEditorBean resource); public void removeStatement(Statement statement); } Index: ResourceEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ResourceEditorBean.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ResourceEditorBean.java 19 Aug 2004 21:27:54 -0000 1.9 --- ResourceEditorBean.java 21 Aug 2004 00:22:49 -0000 1.10 *************** *** 20,40 **** 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(); ) { ! String uri = (String) it.next(); ! System.out.print(ic.isDeclaredClass(uri) ? "D" : "-"); ! System.out.print(ic.isInferredClass(uri) ? "I" : "-"); ! System.out.println(" " + uri); ! }*/ } ! public boolean isRequiredProperty(OntProperty property) { return false; } --- 20,77 ---- package org.javaowl.editor; import com.hp.hpl.jena.rdf.model.Resource; + import com.hp.hpl.jena.vocabulary.RDFS; ! public final class ResourceEditorBean { ! final Resource resource; ! private final ModelEditor editor; ! ! ResourceEditorBean(Resource resource, ModelEditor editor) { ! this.resource = resource; ! this.editor = editor; } ! public String getURI() { ! return resource.getURI(); ! } ! ! public String getLabel(boolean uri) { ! String s = editor.getPropertyValue(this, RDFS.label, uri); ! return s == null ? "" : s; ! } ! ! public void setLabel(String label) { ! if (testEmpty(label)) ! return; ! editor.addPropertyValue(this, RDFS.label, label); ! } ! ! public String getComment(boolean uri) { ! String s = editor.getPropertyValue(this, RDFS.label, uri); ! return s == null ? "" : s; ! } ! ! public void setComment(String comment) { ! if (testEmpty(comment)) ! return; ! editor.addPropertyValue(this, RDFS.comment, comment); ! } ! ! ! private boolean testEmpty(String test) { ! return test == null || test.length() == 0; ! } ! /*InstanceClassification ic = getInstanceClassification(resource); ! for (Iterator it = ic.possibleIterator(); it.hasNext(); ) { ! String uri = (String) it.next(); ! System.out.print(ic.isDeclaredClass(uri) ? "D" : "-"); ! System.out.print(ic.isInferredClass(uri) ? "I" : "-"); ! System.out.println(" " + uri); ! }*/ ! ! ! ! /*public boolean isRequiredProperty(OntProperty property) { return false; } *************** *** 42,46 **** public boolean isValidDataValue(OntProperty property, String value) { return false; ! } } --- 79,83 ---- public boolean isValidDataValue(OntProperty property, String value) { return false; ! }*/ } |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:23:10
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/pe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6871/src/org/javaowl/editor/pe Removed Files: DefaultPropertyEditorPagelet.java CalendarPropertyEditorPagelet.java StringPropertyEditorPagelet.java DurationPropertyEditorPagelet.java NumericPropertyEditorPagelet.java BooleanPropertyEditorPagelet.java Log Message: Moe work on refactoring --- StringPropertyEditorPagelet.java DELETED --- --- DurationPropertyEditorPagelet.java DELETED --- --- CalendarPropertyEditorPagelet.java DELETED --- --- NumericPropertyEditorPagelet.java DELETED --- --- BooleanPropertyEditorPagelet.java DELETED --- --- DefaultPropertyEditorPagelet.java DELETED --- |
|
From: Elmer G. <ega...@us...> - 2004-08-21 00:22:39
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/pe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6815/src/org/javaowl/editor/swing/pe Log Message: Directory /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/pe added to the repository |
|
From: Elmer G. <ega...@us...> - 2004-08-20 18:16:56
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25413/src/org/javaowl/editor/swing Modified Files: BrowsePage.java EditPage.java Log Message: Remote model Index: BrowsePage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/BrowsePage.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BrowsePage.java 19 Aug 2004 14:45:31 -0000 1.6 --- BrowsePage.java 20 Aug 2004 18:16:43 -0000 1.7 *************** *** 156,159 **** --- 156,160 ---- } + //TODO: Check event execution order. public void refresh() { Util.setList(resources, editor.getAllClasses()); Index: EditPage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/EditPage.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EditPage.java 19 Aug 2004 21:27:54 -0000 1.7 --- EditPage.java 20 Aug 2004 18:16:44 -0000 1.8 *************** *** 48,51 **** --- 48,52 ---- import com.hp.hpl.jena.ontology.Individual; + import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntResource; *************** *** 201,205 **** } propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); ! OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = editor.getValidObjects(ontClass); --- 202,206 ---- } propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); ! OntClass ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = editor.getValidObjects(ontClass); *************** *** 221,225 **** propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); if (value instanceof Resource) { ! OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = editor.getValidObjects(ontClass); --- 222,226 ---- propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); if (value instanceof Resource) { ! OntClass ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = editor.getValidObjects(ontClass); |
|
From: Elmer G. <ega...@us...> - 2004-08-20 18:16:55
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25413/src/org/javaowl/editor Modified Files: ModelEditorBean.java ModelEditor.java Log Message: Remote model Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ModelEditorBean.java 19 Aug 2004 21:27:54 -0000 1.13 --- ModelEditorBean.java 20 Aug 2004 18:16:43 -0000 1.14 *************** *** 119,123 **** //TODO: get all valid Instances for the range intersection and the // resource restrictions ! public OntResource getValidLeafClass(Property property) { OntProperty op; if (property instanceof OntProperty) --- 119,123 ---- //TODO: get all valid Instances for the range intersection and the // resource restrictions ! public OntClass getValidLeafClass(Property property) { OntProperty op; if (property instanceof OntProperty) *************** *** 132,139 **** Iterator it2 = oc.listSubClasses(); if (!it2.hasNext() && !or.getNameSpace().equals(XSD.xstring.getNameSpace())) ! list.add(or); } if (list.size() > 0) ! return (OntResource) list.get(0); return null; } --- 132,139 ---- Iterator it2 = oc.listSubClasses(); if (!it2.hasNext() && !or.getNameSpace().equals(XSD.xstring.getNameSpace())) ! list.add(oc); } if (list.size() > 0) ! return (OntClass) list.get(0); return null; } *************** *** 213,219 **** } ! public Individual[] getValidObjects(OntResource resource) { List resources = new ArrayList(); - OntClass oc = resource.asClass(); for (Iterator it = oc.listInstances(); it.hasNext();) resources.add(it.next()); --- 213,218 ---- } ! public Individual[] getValidObjects(OntClass oc) { List resources = new ArrayList(); for (Iterator it = oc.listInstances(); it.hasNext();) resources.add(it.next()); *************** *** 295,299 **** } ! public Resource createResource(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); --- 294,298 ---- } ! public Resource createResource(Resource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); *************** *** 301,305 **** } ! public Resource createResource(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); --- 300,304 ---- } ! public Resource createResource(String uri, Resource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); Index: ModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditor.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ModelEditor.java 19 Aug 2004 21:27:54 -0000 1.26 --- ModelEditor.java 20 Aug 2004 18:16:43 -0000 1.27 *************** *** 31,77 **** public interface ModelEditor { - - public OntClass[] getAllClasses(); ! public OntProperty[] getProperties(Resource clazz, boolean all); ! public OntProperty[] getAllDatatypeProperties(); ! public Resource[] getInstances(Resource clazz, boolean all); ! public OntClass getOntClass(Resource resource); ! public OntProperty getOntProperty(Property property); ! public Literal getTypedLiteral(Object value, OntResource type); ! public void removeStatement(Statement statement); ! public void removeResource(Resource resource); ! public OntClass[] getSubClasses(OntClass resourceClass); ! ! public Resource createResource(OntResource classResource); ! public Resource createResource(String uri, OntResource classResource); ! public OntProperty[] getApplicableProperties(Resource resource); ! 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); } --- 31,77 ---- public interface ModelEditor { ! public Statement addDataValue(Resource resource, Property currentProperty, Literal typedLiteral); ! public Statement addObjectValue(Resource resource, Property currentProperty, Resource value); ! ! public Resource createResource(Resource classResource); ! public Resource createResource(String uri, Resource classResource); ! ! public OntClass[] getAllClasses(); ! public OntProperty[] getAllDatatypeProperties(); ! public OntProperty[] getApplicableProperties(Resource resource); ! public String getComment(Resource resource); ! public Statement[] getDeclaredProperties(Resource resource); ! public Resource[] getInstances(Resource clazz, boolean all); ! public String getLabel(Resource resource); ! public OntClass getOntClass(Resource resource); ! public OntProperty getOntProperty(Property property); ! public OntProperty[] getProperties(Resource clazz, boolean all); ! public OntClass[] getSubClasses(OntClass resourceClass); ! public Literal getTypedLiteral(Object value, OntResource type); ! public OntClass getValidLeafClass(Property currentProperty); ! public Individual[] getValidObjects(OntClass ontClass); ! public void removeResource(Resource resource); ! public void removeStatement(Statement statement); ! public void setComment(Resource resource, String comment); ! public void setLabel(Resource resource, String label); } |
|
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); + } |
|
From: Elmer G. <ega...@us...> - 2004-08-19 21:33:51
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/pe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27689/src/org/javaowl/editor/pe Added Files: NumericPropertyEditorPagelet.java CalendarPropertyEditorPagelet.java DefaultPropertyEditorPagelet.java BooleanPropertyEditorPagelet.java DurationPropertyEditorPagelet.java StringPropertyEditorPagelet.java Log Message: Moved PropertyEditor's to package org.javaowl.editor.swing.pe --- NEW FILE: StringPropertyEditorPagelet.java --- /* * StringPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextField; import org.javaowl.editor.swing.EditPage; import org.javaowl.editor.swing.PropertyEditorPagelet; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Resource; public class StringPropertyEditorPagelet implements PropertyEditorPagelet { private JTextField textField = new JTextField(30); private JPanel textPanel = new JPanel(); private final JPanel component; private EditPage editPage; private OntResource rangeType; public StringPropertyEditorPagelet() { component = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); JButton ok = new JButton("Set property"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(false); } }); buttonPanel.add(ok); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(true); } }); buttonPanel.add(cancel); textPanel.add(textField); component.add(buttonPanel, BorderLayout.SOUTH); } public void setValues(Resource[] o, Resource value, OntResource resourceClass) { } public void setValue(String o) { textField.setText(o); component.add(textPanel, BorderLayout.CENTER); } private void setValue(boolean cancel) { if (cancel) { editPage.cancel(); } else if (!textField.getText().equals("")) { editPage.setProperty(textField.getText(), rangeType); } else { editPage.cancel(); } } public void setRangeType(OntResource rangeType) { this.rangeType = rangeType; } public void setEditPage(EditPage editPage) { this.editPage = editPage; } public Component getComponent() { return component; } } --- NEW FILE: DurationPropertyEditorPagelet.java --- /* * DurationPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; public class DurationPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: CalendarPropertyEditorPagelet.java --- /* * CalendarPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; public class CalendarPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: NumericPropertyEditorPagelet.java --- /* * NumericPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; public class NumericPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: BooleanPropertyEditorPagelet.java --- /* * BooleanPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; public class BooleanPropertyEditorPagelet extends StringPropertyEditorPagelet { } --- NEW FILE: DefaultPropertyEditorPagelet.java --- /* * DefaultPropertyEditorPagelet.java Copyright (C) 2004 Elmer Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.pe; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.ListCellRenderer; import org.javaowl.editor.swing.EditPage; import org.javaowl.editor.swing.LabelListCellRenderer; import org.javaowl.editor.swing.PropertyEditorPagelet; import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Resource; public class DefaultPropertyEditorPagelet implements PropertyEditorPagelet { private JTextField textField = new JTextField(30); private JComboBox comboBox = new JComboBox(); private JPanel textPanel = new JPanel(); private JPanel comboPanel = new JPanel(); private OntResource resourceClass; private final JPanel component; private EditPage editPage; private OntResource rangeType; public DefaultPropertyEditorPagelet() { ListCellRenderer renderer = new LabelListCellRenderer(); comboBox.setRenderer(renderer); component = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); JButton ok = new JButton("Set property"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(false); } }); buttonPanel.add(ok); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setValue(true); } }); buttonPanel.add(cancel); textPanel.add(textField); comboPanel.add(comboBox); JButton create = new JButton("Create resource"); create.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editPage.notifyCreateResource(resourceClass); } }); comboPanel.add(create); component.add(buttonPanel, BorderLayout.SOUTH); } public void setValues(Resource[] o, Resource value, OntResource resourceClass) { this.resourceClass = resourceClass; textField.setText(null); comboBox.removeAllItems(); if (o != null) { for (int i = 0; i < o.length; i++) comboBox.addItem(o[i]); } else comboBox.addItem(value); comboBox.setSelectedItem(value); component.remove(textPanel); component.add(comboPanel, BorderLayout.CENTER); } public void setValue(String o) { comboBox.removeAllItems(); textField.setText(o); component.remove(comboPanel); component.add(textPanel, BorderLayout.CENTER); } private void setValue(boolean cancel) { if (cancel) { editPage.cancel(); } else if (comboBox.getItemCount() == 0 && !textField.getText().equals("")) { editPage.setProperty(textField.getText(), rangeType); } else if (textField.getText().equals("") && comboBox.getItemCount() != 0) { editPage.setProperty((Resource) comboBox.getSelectedItem()); } else { editPage.cancel(); } } public void setRangeType(OntResource rangeType) { this.rangeType = rangeType; } public void setEditPage(EditPage editPage) { this.editPage = editPage; } public Component getComponent() { return component; } } |
|
From: Elmer G. <ega...@us...> - 2004-08-19 21:33:51
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27689/src/org/javaowl/editor/swing Modified Files: Editor.java Removed Files: DurationPropertyEditorPagelet.java StringPropertyEditorPagelet.java CalendarPropertyEditorPagelet.java BooleanPropertyEditorPagelet.java NumericPropertyEditorPagelet.java DefaultPropertyEditorPagelet.java Log Message: Moved PropertyEditor's to package org.javaowl.editor.swing.pe --- StringPropertyEditorPagelet.java DELETED --- --- DurationPropertyEditorPagelet.java DELETED --- --- CalendarPropertyEditorPagelet.java DELETED --- Index: Editor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/Editor.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Editor.java 19 Aug 2004 21:27:54 -0000 1.27 --- Editor.java 19 Aug 2004 21:33:42 -0000 1.28 *************** *** 204,208 **** resource.equals(XSD.normalizedString) || resource.equals(XSD.token)) ! return Class.forName("org.javaowl.editor.swing.StringPropertyEditorPagelet"); if (resource.equals(XSD.integer) || resource.equals(XSD.xbyte) || --- 204,208 ---- resource.equals(XSD.normalizedString) || resource.equals(XSD.token)) ! return Class.forName("org.javaowl.editor.swing.pe.StringPropertyEditorPagelet"); if (resource.equals(XSD.integer) || resource.equals(XSD.xbyte) || *************** *** 221,227 **** resource.equals(XSD.xfloat) || resource.equals(XSD.xdouble)) ! return Class.forName("org.javaowl.editor.swing.NumericPropertyEditorPagelet"); if (resource.equals(XSD.xboolean)) ! return Class.forName("org.javaowl.editor.swing.BooleanPropertyEditorPagelet"); if (resource.equals(XSD.time) || resource.equals(XSD.dateTime) || --- 221,227 ---- resource.equals(XSD.xfloat) || resource.equals(XSD.xdouble)) ! return Class.forName("org.javaowl.editor.swing.pe.NumericPropertyEditorPagelet"); if (resource.equals(XSD.xboolean)) ! return Class.forName("org.javaowl.editor.swing.pe.BooleanPropertyEditorPagelet"); if (resource.equals(XSD.time) || resource.equals(XSD.dateTime) || *************** *** 232,239 **** resource.equals(XSD.gDay) || resource.equals(XSD.gMonthDay)) ! return Class.forName("org.javaowl.editor.swing.CalendarPropertyEditorPagelet"); if (resource.equals(XSD.duration)) ! return Class.forName("org.javaowl.editor.swing.DurationPropertyEditorPagelet"); ! return Class.forName("org.javaowl.editor.swing.DefaultPropertyEditorPagelet"); } --- 232,239 ---- resource.equals(XSD.gDay) || resource.equals(XSD.gMonthDay)) ! return Class.forName("org.javaowl.editor.swing.pe.CalendarPropertyEditorPagelet"); if (resource.equals(XSD.duration)) ! return Class.forName("org.javaowl.editor.swing.pe.DurationPropertyEditorPagelet"); ! return Class.forName("org.javaowl.editor.swing.pe.DefaultPropertyEditorPagelet"); } --- NumericPropertyEditorPagelet.java DELETED --- --- BooleanPropertyEditorPagelet.java DELETED --- --- DefaultPropertyEditorPagelet.java DELETED --- |
|
From: Elmer G. <ega...@us...> - 2004-08-19 21:33:46
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/pe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27670/src/org/javaowl/editor/pe Log Message: Directory /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/pe added to the repository |
|
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; } } |
|
From: Elmer G. <ega...@us...> - 2004-08-19 21:28:04
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26693/src/org/javaowl/editor/swing Modified Files: Editor.java EditPage.java Log Message: Removed all references to ResourceEditorBean Index: EditPage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/EditPage.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EditPage.java 19 Aug 2004 14:45:32 -0000 1.6 --- EditPage.java 19 Aug 2004 21:27:54 -0000 1.7 *************** *** 46,50 **** import org.javaowl.editor.ModelEditor; - import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.Individual; --- 46,49 ---- *************** *** 71,76 **** private JSplitPane center; - private final ResourceEditorBean resourceEditor; - private Statement currentStatement; --- 70,73 ---- *************** *** 83,90 **** private Resource resource; ! public EditPage(ModelEditor editor, ResourceEditorBean resourceEditor, Map propertyEditors, Editor e, Resource resource) { this.editor = editor; this.e = e; - this.resourceEditor = resourceEditor; this.resource = resource; for (Iterator it = propertyEditors.entrySet().iterator(); it.hasNext();) { --- 80,86 ---- private Resource resource; ! public EditPage(ModelEditor editor, Map propertyEditors, Editor e, Resource resource) { this.editor = editor; this.e = e; this.resource = resource; for (Iterator it = propertyEditors.entrySet().iterator(); it.hasNext();) { *************** *** 207,211 **** OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { ! Individual[] values = resourceEditor.getValidObjects(ontClass); propertyEditor.setValues(values, null, ontClass); } else { --- 203,207 ---- OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { ! Individual[] values = editor.getValidObjects(ontClass); propertyEditor.setValues(values, null, ontClass); } else { *************** *** 227,231 **** OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { ! Individual[] values = resourceEditor.getValidObjects(ontClass); propertyEditor.setValues(values, (Resource) value, ontClass); } else { --- 223,227 ---- OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { ! Individual[] values = editor.getValidObjects(ontClass); propertyEditor.setValues(values, (Resource) value, ontClass); } else { *************** *** 272,278 **** private String getStatus() { StringBuffer sb = new StringBuffer(); ! sb.append(resourceEditor.getLabel()); sb.append(": <"); ! sb.append(resourceEditor.getResource().getURI()); sb.append(">"); return sb.toString(); --- 268,274 ---- private String getStatus() { StringBuffer sb = new StringBuffer(); ! sb.append(editor.getLabel(resource)); sb.append(": <"); ! sb.append(resource.getURI()); sb.append(">"); return sb.toString(); *************** *** 283,287 **** editor.removeStatement(currentStatement); } ! values.add(resourceEditor.addDataValue(currentProperty, editor.getTypedLiteral(value, type))); propertyEditor = null; --- 279,283 ---- editor.removeStatement(currentStatement); } ! values.add(editor.addDataValue(resource, currentProperty, editor.getTypedLiteral(value, type))); propertyEditor = null; *************** *** 290,298 **** } ! public void setProperty(Resource resource) { if (currentStatement != null) { editor.removeStatement(currentStatement); } ! values.add(resourceEditor.addObjectValue(currentProperty, resource)); propertyEditor = null; currentStatement = null; --- 286,294 ---- } ! public void setProperty(Resource value) { if (currentStatement != null) { editor.removeStatement(currentStatement); } ! values.add(editor.addObjectValue(resource, currentProperty, value)); propertyEditor = null; currentStatement = null; Index: Editor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/Editor.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Editor.java 19 Aug 2004 14:45:31 -0000 1.26 --- Editor.java 19 Aug 2004 21:27:54 -0000 1.27 *************** *** 43,47 **** import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ModelEditorBean; - import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.OntProperty; --- 43,46 ---- *************** *** 176,183 **** public void editResource(Resource resource) { ! ResourceEditorBean current = editor.getResourceEditor(resource); ! EditPage editPage = new EditPage(editor, current, panels, this, resource); addPane(editPage); ! setText(current); } --- 175,181 ---- public void editResource(Resource resource) { ! EditPage editPage = new EditPage(editor, panels, this, resource); addPane(editPage); ! setText(resource); } *************** *** 186,200 **** String uri = uriChooser.getURI(); String label = uriChooser.getLabel(); ! ResourceEditorBean current; ! Resource currentResource; if (uri == null) { ! current = editor.createResourceEditor(resource); ! currentResource = editor.createResource(resource); } else { ! current = editor.createResourceEditor(uri, resource); ! currentResource = editor.createResource(resource); } ! current.setLabel(label); ! EditPage editPage = new EditPage(editor, current, panels, this, currentResource); addPane(editPage); setText(current); --- 184,195 ---- String uri = uriChooser.getURI(); String label = uriChooser.getLabel(); ! Resource current; if (uri == null) { ! current = editor.createResource(resource); } else { ! current = editor.createResource(resource); } ! editor.setLabel(current, label); ! EditPage editPage = new EditPage(editor, panels, this, current); addPane(editPage); setText(current); *************** *** 243,252 **** } ! private void setText(ResourceEditorBean resource) { if (resource != null) { StringBuffer sb = new StringBuffer(); ! sb.append(resource.getLabel()); sb.append(": <"); ! sb.append(resource.getResource().getURI()); sb.append(">"); setStatus(sb.toString()); --- 238,247 ---- } ! private void setText(Resource resource) { if (resource != null) { StringBuffer sb = new StringBuffer(); ! sb.append(editor.getLabel(resource)); sb.append(": <"); ! sb.append(resource.getURI()); sb.append(">"); setStatus(sb.toString()); |
|
From: Elmer G. <ega...@us...> - 2004-08-19 21:28:04
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26693/src/org/javaowl/editor/remote Modified Files: RemoteModelEditorWrapper.java Log Message: Removed all references to ResourceEditorBean Index: RemoteModelEditorWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditorWrapper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RemoteModelEditorWrapper.java 19 Aug 2004 14:45:32 -0000 1.3 --- RemoteModelEditorWrapper.java 19 Aug 2004 21:27:54 -0000 1.4 *************** *** 21,26 **** import org.javaowl.editor.ModelEditor; - import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; --- 21,26 ---- import org.javaowl.editor.ModelEditor; + import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; *************** *** 91,118 **** } - - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#createResource(com.hp.hpl.jena.ontology.OntResource) - */ - public ResourceEditorBean createResourceEditor(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 ResourceEditorBean createResourceEditor(String uri, OntResource classResource) { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#getResource(com.hp.hpl.jena.rdf.model.Resource) - */ - public ResourceEditorBean getResourceEditor(Resource resource) { - // TODO Auto-generated method stub - return null; - } private OntClass[] createOntClassesFromUri(String[] uris) { --- 91,94 ---- *************** *** 162,164 **** --- 138,181 ---- } + 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 + + } + + } |
|
From: Elmer G. <ega...@us...> - 2004-08-19 14:45:43
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17990/src/org/javaowl/editor/remote Modified Files: RemoteModelEditor.java RemoteModelEditorWrapper.java Added Files: SerializableTriple.java Log Message: more work on remote model Index: RemoteModelEditorWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditorWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemoteModelEditorWrapper.java 18 Aug 2004 01:23:24 -0000 1.2 --- RemoteModelEditorWrapper.java 19 Aug 2004 14:45:32 -0000 1.3 *************** *** 20,25 **** package org.javaowl.editor.remote; - import java.util.Set; - import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ResourceEditorBean; --- 20,23 ---- *************** *** 30,34 **** import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Literal; - import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; --- 28,31 ---- *************** *** 48,133 **** public OntClass[] getAllClasses() { String[] uris = remote.getAllClasses(); ! OntClass[] resources = new OntClass[uris.length]; ! for (int i = 0; i < uris.length; i++) ! resources[i] = ontModel.createClass(uris[i]); ! return null; ! } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getPropertiesURIs(com.hp.hpl.jena.rdf.model.Resource, boolean) ! */ ! public Set getPropertiesURIs(Resource clazz, boolean all) { ! // TODO Auto-generated method stub ! return null; } ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getProperties(com.hp.hpl.jena.rdf.model.Resource, boolean) ! */ ! public OntProperty[] getProperties(Resource clazz, boolean all) { ! // TODO Auto-generated method stub ! return null; } ! ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getAllDatatypeProperties() ! */ public OntProperty[] getAllDatatypeProperties() { ! // TODO Auto-generated method stub ! return null; } ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getInstances(com.hp.hpl.jena.ontology.OntResource, boolean) ! */ ! public Resource[] getInstances(OntResource clazz, boolean all) { ! // TODO Auto-generated method stub ! return null; } - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#getOntClass(com.hp.hpl.jena.rdf.model.Resource) - */ public OntClass getOntClass(Resource resource) { ! // TODO Auto-generated method stub ! return null; } - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#getOntProperty(com.hp.hpl.jena.rdf.model.Property) - */ public OntProperty getOntProperty(Property property) { ! // TODO Auto-generated method stub ! return null; } - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#getTypedLiteral(java.lang.Object, com.hp.hpl.jena.ontology.OntResource) - */ public Literal getTypedLiteral(Object value, OntResource type) { ! // TODO Auto-generated method stub ! return null; } - /* (non-Javadoc) - * @see org.javaowl.editor.ModelEditor#removeStatement(com.hp.hpl.jena.rdf.model.Statement) - */ public void removeStatement(Statement statement) { ! // TODO Auto-generated method stub } /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#removeResource(com.hp.hpl.jena.rdf.model.Resource) */ ! public void removeResource(Resource resource) { // TODO Auto-generated method stub ! } /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getSubClasses(com.hp.hpl.jena.ontology.OntClass) */ ! public OntClass[] getSubClasses(OntClass resourceClass) { // TODO Auto-generated method stub return null; --- 45,107 ---- public OntClass[] getAllClasses() { String[] uris = remote.getAllClasses(); ! return createOntClassesFromUri(uris); } ! public OntClass[] getSubClasses(OntClass resourceClass) { ! String[] uris = remote.getSubClasses(resourceClass.getURI()); ! return createOntClassesFromUri(uris); } ! public OntProperty[] getAllDatatypeProperties() { ! String[] uris = remote.getAllDatatypeProperties(); ! return createOntPropertiesFromURIs(uris); } ! public OntProperty[] getProperties(Resource clazz, boolean all) { ! String[] uris = remote.getProperties(clazz.getURI(), all); ! return createOntPropertiesFromURIs(uris); ! } ! ! public Resource[] getInstances(Resource clazz, boolean all) { ! String[] uris = remote.getInstances(clazz.getURI(), all); ! Resource[] resources = new Resource[uris.length]; ! for (int i = 0; i < uris.length; i++) ! resources[i] = ontModel.createOntProperty(uris[i]); ! return resources; } 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 ontModel.createTypedLiteral(value, type.getURI()); } public void removeStatement(Statement statement) { ! remote.removeStatement(new SerializableTriple(statement.asTriple())); ! } ! ! public void removeResource(Resource resource) { ! remote.removeResource(resource.getURI()); } /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#createResource(com.hp.hpl.jena.ontology.OntResource) */ ! public ResourceEditorBean createResourceEditor(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 ResourceEditorBean createResourceEditor(String uri, OntResource classResource) { // TODO Auto-generated method stub return null; *************** *** 135,149 **** /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#createResource(com.hp.hpl.jena.ontology.OntResource) */ ! public ResourceEditorBean 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 ResourceEditorBean createResource(String uri, OntResource classResource) { // TODO Auto-generated method stub return null; --- 109,137 ---- /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getResource(com.hp.hpl.jena.rdf.model.Resource) */ ! public ResourceEditorBean getResourceEditor(Resource resource) { // TODO Auto-generated method stub return null; } + + private OntClass[] createOntClassesFromUri(String[] uris) { + OntClass[] classes = new OntClass[uris.length]; + for (int i = 0; i < uris.length; i++) + classes[i] = ontModel.createClass(uris[i]); + return classes; + } + + private OntProperty[] createOntPropertiesFromURIs(String[] uris) { + OntProperty[] properties = new OntProperty[uris.length]; + for (int i = 0; i < uris.length; i++) + properties[i] = ontModel.createOntProperty(uris[i]); + 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; *************** *** 151,157 **** /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getResource(com.hp.hpl.jena.rdf.model.Resource) */ ! public ResourceEditorBean getResource(Resource resource) { // TODO Auto-generated method stub return null; --- 139,145 ---- /* (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; *************** *** 159,165 **** /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getOntology() */ ! public Model getOntology() { // TODO Auto-generated method stub return null; --- 147,153 ---- /* (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; *************** *** 167,173 **** /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getData() */ ! public Model getData() { // TODO Auto-generated method stub return null; --- 155,161 ---- /* (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; Index: RemoteModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemoteModelEditor.java 18 Aug 2004 01:23:24 -0000 1.2 --- RemoteModelEditor.java 19 Aug 2004 14:45:32 -0000 1.3 *************** *** 29,31 **** --- 29,66 ---- 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); + } --- NEW FILE: SerializableTriple.java --- /* * RemoteGraph.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer * Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.remote; import java.io.Serializable; import com.hp.hpl.jena.graph.Triple; import org.javaowl.models.prevalence.TripleUtil; public class SerializableTriple implements Serializable { private String subject; private String predicate; private String object; public SerializableTriple() {} public SerializableTriple(Triple triple) { subject = TripleUtil.nodeToString(triple.getSubject()); predicate = TripleUtil.nodeToString(triple.getPredicate()); object = TripleUtil.nodeToString(triple.getObject()); } public String getObject() { return object; } public String getPredicate(){ return predicate; } public String getSubject(){ return subject; } public void setObject(String object){ this.object = object; } public void setPredicate(String predicate){ this.predicate = predicate; } public void setSubject(String subject){ this.subject = subject; } } |
|
From: Elmer G. <ega...@us...> - 2004-08-19 14:45:43
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17990/src/org/javaowl/editor/swing Modified Files: BrowsePage.java OntTreePagelet.java Editor.java EditPage.java Log Message: more work on remote model Index: OntTreePagelet.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/OntTreePagelet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OntTreePagelet.java 28 Jul 2004 07:17:03 -0000 1.5 --- OntTreePagelet.java 19 Aug 2004 14:45:31 -0000 1.6 *************** *** 33,37 **** import javax.swing.tree.TreeSelectionModel; ! import org.javaowl.editor.ModelEditorBean; import com.hp.hpl.jena.ontology.OntClass; --- 33,37 ---- import javax.swing.tree.TreeSelectionModel; ! import org.javaowl.editor.ModelEditor; import com.hp.hpl.jena.ontology.OntClass; *************** *** 44,48 **** public class OntTreePagelet implements Pagelet { ! private final ModelEditorBean editor; private final JTree component; --- 44,48 ---- public class OntTreePagelet implements Pagelet { ! private final ModelEditor editor; private final JTree component; *************** *** 52,56 **** private final BrowsePage browsePage; ! public OntTreePagelet(ModelEditorBean editor, BrowsePage browsePage) { this.editor = editor; this.browsePage = browsePage; --- 52,56 ---- private final BrowsePage browsePage; ! public OntTreePagelet(ModelEditor editor, BrowsePage browsePage) { this.editor = editor; this.browsePage = browsePage; Index: EditPage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/EditPage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EditPage.java 28 Jul 2004 07:17:04 -0000 1.5 --- EditPage.java 19 Aug 2004 14:45:32 -0000 1.6 *************** *** 45,49 **** import javax.swing.table.DefaultTableCellRenderer; ! import org.javaowl.editor.ModelEditorBean; import org.javaowl.editor.ResourceEditorBean; --- 45,49 ---- import javax.swing.table.DefaultTableCellRenderer; ! import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ResourceEditorBean; *************** *** 51,56 **** import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntResource; - import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; --- 51,56 ---- 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; *************** *** 63,67 **** private TableModel values = new TableModel(); ! private final ModelEditorBean editor; private final Component component; --- 63,67 ---- private TableModel values = new TableModel(); ! private final ModelEditor editor; private final Component component; *************** *** 81,88 **** private Editor e; ! public EditPage(ModelEditorBean editor, ResourceEditorBean resourceEditor, Map propertyEditors, Editor e) { this.editor = editor; this.e = e; this.resourceEditor = resourceEditor; for (Iterator it = propertyEditors.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); --- 81,91 ---- private Editor e; ! private Resource resource; ! ! public EditPage(ModelEditor editor, ResourceEditorBean resourceEditor, Map propertyEditors, Editor e, Resource resource) { this.editor = editor; this.e = e; this.resourceEditor = resourceEditor; + this.resource = resource; for (Iterator it = propertyEditors.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); *************** *** 202,206 **** } propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); ! OntResource ontClass = resourceEditor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = resourceEditor.getValidObjects(ontClass); --- 205,209 ---- } propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); ! OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = resourceEditor.getValidObjects(ontClass); *************** *** 222,226 **** propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); if (value instanceof Resource) { ! OntResource ontClass = resourceEditor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = resourceEditor.getValidObjects(ontClass); --- 225,229 ---- propertyEditor.setRangeType(editor.getOntProperty(currentProperty).getRange()); if (value instanceof Resource) { ! OntResource ontClass = editor.getValidLeafClass(currentProperty); if (ontClass != null) { Individual[] values = resourceEditor.getValidObjects(ontClass); *************** *** 254,260 **** private void refresh() { ! Util.setList(properties, resourceEditor.getApplicableProperties()); values.clear(); ! Statement[] stmts = resourceEditor.getDeclaredProperties(); for (int i = 0; i < stmts.length; i++) values.add(stmts[i]); --- 257,263 ---- private void refresh() { ! Util.setList(properties, editor.getApplicableProperties(resource)); values.clear(); ! Statement[] stmts = editor.getDeclaredProperties(resource); for (int i = 0; i < stmts.length; i++) values.add(stmts[i]); Index: BrowsePage.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/BrowsePage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BrowsePage.java 27 Jul 2004 17:25:36 -0000 1.5 --- BrowsePage.java 19 Aug 2004 14:45:31 -0000 1.6 *************** *** 38,42 **** import javax.swing.ListSelectionModel; ! import org.javaowl.editor.ModelEditorBean; import com.hp.hpl.jena.ontology.OntResource; --- 38,42 ---- import javax.swing.ListSelectionModel; ! import org.javaowl.editor.ModelEditor; import com.hp.hpl.jena.ontology.OntResource; *************** *** 52,56 **** private final DefaultListModel instances = new DefaultListModel(); ! private final ModelEditorBean editor; private final Component component; --- 52,56 ---- private final DefaultListModel instances = new DefaultListModel(); ! private final ModelEditor editor; private final Component component; *************** *** 68,72 **** private OntResource resource; ! public BrowsePage(ModelEditorBean editor, Editor e) { this.editor = editor; this.e = e; --- 68,72 ---- private OntResource resource; ! public BrowsePage(ModelEditor editor, Editor e) { this.editor = editor; this.e = e; Index: Editor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/Editor.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Editor.java 28 Jul 2004 07:17:03 -0000 1.25 --- Editor.java 19 Aug 2004 14:45:31 -0000 1.26 *************** *** 41,44 **** --- 41,45 ---- import org.javaowl.models.prevalence.PrevalentGraph; + import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ModelEditorBean; import org.javaowl.editor.ResourceEditorBean; *************** *** 61,65 **** private JTextField status; ! private ModelEditorBean editor; private LinkedList stack = new LinkedList(); --- 62,66 ---- private JTextField status; ! private ModelEditor editor; private LinkedList stack = new LinkedList(); *************** *** 81,89 **** Model data = ModelFactory.createModelForGraph(new PrevalentGraph(args[1])); ! ModelEditorBean editor = new ModelEditorBean(ontology, data, args[2]); new Editor(editor).show(); } ! public Editor(ModelEditorBean editor) { this.editor = editor; init(); --- 82,90 ---- Model data = ModelFactory.createModelForGraph(new PrevalentGraph(args[1])); ! ModelEditor editor = new ModelEditorBean(ontology, data, args[2]); new Editor(editor).show(); } ! public Editor(ModelEditor editor) { this.editor = editor; init(); *************** *** 175,180 **** public void editResource(Resource resource) { ! ResourceEditorBean current = editor.getResource(resource); ! EditPage editPage = new EditPage(editor, current, panels, this); addPane(editPage); setText(current); --- 176,181 ---- public void editResource(Resource resource) { ! ResourceEditorBean current = editor.getResourceEditor(resource); ! EditPage editPage = new EditPage(editor, current, panels, this, resource); addPane(editPage); setText(current); *************** *** 186,195 **** String label = uriChooser.getLabel(); ResourceEditorBean current; ! if (uri == null) ! current = editor.createResource(resource); ! else ! current = editor.createResource(uri, resource); current.setLabel(label); ! EditPage editPage = new EditPage(editor, current, panels, this); addPane(editPage); setText(current); --- 187,200 ---- String label = uriChooser.getLabel(); ResourceEditorBean current; ! Resource currentResource; ! if (uri == null) { ! current = editor.createResourceEditor(resource); ! currentResource = editor.createResource(resource); ! } else { ! current = editor.createResourceEditor(uri, resource); ! currentResource = editor.createResource(resource); ! } current.setLabel(label); ! EditPage editPage = new EditPage(editor, current, panels, this, currentResource); addPane(editPage); setText(current); |
|
From: Elmer G. <ega...@us...> - 2004-08-19 14:45:42
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17990/src/org/javaowl/models/remote Modified Files: RemoteGraph.java RemoteGraphWrapper.java Removed Files: SerializableTriple.java Log Message: more work on remote model Index: RemoteGraphWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraphWrapper.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RemoteGraphWrapper.java 17 Aug 2004 20:18:13 -0000 1.5 --- RemoteGraphWrapper.java 19 Aug 2004 14:45:32 -0000 1.6 *************** *** 41,44 **** --- 41,45 ---- import com.hp.hpl.jena.graph.GraphUtil; + import org.javaowl.editor.remote.SerializableTriple; import org.javaowl.models.prevalence.TripleUtil; Index: RemoteGraph.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraph.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RemoteGraph.java 17 Aug 2004 23:46:02 -0000 1.7 --- RemoteGraph.java 19 Aug 2004 14:45:32 -0000 1.8 *************** *** 22,25 **** --- 22,27 ---- import java.rmi.Remote; import java.rmi.RemoteException; + + import org.javaowl.editor.remote.SerializableTriple; public interface RemoteGraph extends Remote { --- SerializableTriple.java DELETED --- |
|
From: Elmer G. <ega...@us...> - 2004-08-19 14:45:41
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17990/src/org/javaowl/editor Modified Files: ModelEditorBean.java ResourceEditorBean.java ModelEditor.java Log Message: more work on remote model Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ModelEditorBean.java 18 Aug 2004 01:23:23 -0000 1.11 --- ModelEditorBean.java 19 Aug 2004 14:45:22 -0000 1.12 *************** *** 44,48 **** --- 44,50 ---- import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; + import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.vocabulary.RDF; + import com.hp.hpl.jena.vocabulary.XSD; public class ModelEditorBean implements ModelEditor { *************** *** 93,97 **** } ! public Set getPropertiesURIs(Resource clazz, boolean all) { List l = new ArrayList(); l.add(clazz.getURI()); --- 95,99 ---- } ! private Set getPropertiesURIs(Resource clazz, boolean all) { List l = new ArrayList(); l.add(clazz.getURI()); *************** *** 113,116 **** --- 115,169 ---- } + //TODO: get all valid Instances for the range intersection and the + // resource restrictions + public OntResource getValidLeafClass(Property property) { + OntProperty op; + if (property instanceof OntProperty) + op = (OntProperty) property; + else + op = ontModel.createOntProperty(property.getURI()); + List list = new ArrayList(); + // TODO: fix this. Many ranges on a property implies an intersection... + for (Iterator it = op.listRange(); it.hasNext();) { + OntResource or = (OntResource) it.next(); + OntClass oc = or.asClass(); + Iterator it2 = oc.listSubClasses(); + if (!it2.hasNext() && !or.getNameSpace().equals(XSD.xstring.getNameSpace())) + list.add(or); + } + if (list.size() > 0) + return (OntResource) list.get(0); + return null; + } + + public OntProperty[] getApplicableProperties(Resource resource) { + Set props = new HashSet(); + InstanceClassification ic = getInstanceClassification(resource); + for (Iterator iter = ic.possibleIterator(); iter.hasNext(); ) { + String uri = (String) iter.next(); + if (ic.isDeclaredClass(uri) || ic.isInferredClass(uri)) { + OntClass resourceClass = ontModel.getOntClass(uri); + props.addAll(getPropertiesURIs(resourceClass, true)); + } + } + OntProperty[] result = new OntProperty[props.size()]; + int i = 0; + for (Iterator iter = props.iterator(); iter.hasNext(); ) { + String uri = (String) iter.next(); + result[i++] = ontModel.getOntProperty(uri); + } + return result; + } + + public Statement[] getDeclaredProperties(Resource resource) { + List resources = new ArrayList(); + for (Iterator it = resource.listProperties(); it.hasNext();) { + Statement stmt = (Statement) it.next(); + if (stmt.getPredicate().getNameSpace().equals(prefix)) + resources.add(stmt); + } + return (Statement[]) resources.toArray(new Statement[0]); + } + public OntProperty[] getProperties(Resource clazz, boolean all) { Set props = getPropertiesURIs(clazz, all); *************** *** 132,136 **** } ! public Resource[] getInstances(OntResource clazz, boolean all) { List resources = new ArrayList(); if (all) { --- 185,189 ---- } ! public Resource[] getInstances(Resource clazz, boolean all) { List resources = new ArrayList(); if (all) { *************** *** 157,160 **** --- 210,241 ---- } + + public InstanceClassification getInstanceClassification(Resource instance) { + EditorReasoner reasoner = new EditorReasoner(); + Model model = ModelFactory.createDefaultModel(); + model.add(ontology); + model.add(data); + try { + reasoner.loadOntology(model); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("instance reasoner exception: ", e); + } + InstanceClassification result = new InstanceClassification(); + Resource modelInstance = data.getResource(instance.getURI()); + for (StmtIterator iter = modelInstance.listProperties(RDF.type); iter.hasNext(); ) + result.addDeclaredClass(iter.nextStatement().getObject().toString()); + OntClass[] classes = getAllClasses(); + for (int i = 0; i < classes.length; i++) { + OntClass oc = classes[i]; + String uri = oc.getURI(); + if (!result.isDeclaredClass(uri) && reasoner.isType(instance, oc)) + result.addInferredClass(uri); + if (result.isDeclaredClass(uri) || result.isInferredClass(uri) || + reasoner.canBeInstanceOf(instance, oc)) + result.addPossibleClass(uri); + } + return result; + } public OntClass getOntClass(Resource resource) { *************** *** 193,218 **** } ! public ResourceEditorBean createResource(OntResource classResource) { Resource r = data.createResource(); r.addProperty(RDF.type, classResource); ! return new ResourceEditorBean(r, prefix, ontModel, this); } ! public ResourceEditorBean createResource(String uri, OntResource classResource) { Resource r = data.createResource(uri); r.addProperty(RDF.type, classResource); ! return new ResourceEditorBean(r, prefix, ontModel, this); } ! public ResourceEditorBean getResource(Resource resource) { ! return new ResourceEditorBean(resource, prefix, ontModel, this); } ! ! public Model getOntology() { ! return ontology; } ! ! public Model getData() { ! return data; } --- 274,303 ---- } ! 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; } Index: ModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditor.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ModelEditor.java 18 Aug 2004 01:23:23 -0000 1.24 --- ModelEditor.java 19 Aug 2004 14:45:31 -0000 1.25 *************** *** 20,24 **** package org.javaowl.editor; - import java.util.Set; import com.hp.hpl.jena.ontology.OntClass; --- 20,23 ---- *************** *** 26,30 **** import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.rdf.model.Literal; - import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; --- 25,28 ---- *************** *** 35,45 **** public OntClass[] getAllClasses(); - public Set getPropertiesURIs(Resource clazz, boolean all); - public OntProperty[] getProperties(Resource clazz, boolean all); public OntProperty[] getAllDatatypeProperties(); ! public Resource[] getInstances(OntResource clazz, boolean all); public OntClass getOntClass(Resource resource); --- 33,41 ---- public OntClass[] getAllClasses(); public OntProperty[] getProperties(Resource clazz, boolean all); public OntProperty[] getAllDatatypeProperties(); ! public Resource[] getInstances(Resource clazz, boolean all); public OntClass getOntClass(Resource resource); *************** *** 55,66 **** public OntClass[] getSubClasses(OntClass resourceClass); ! public ResourceEditorBean createResource(OntResource classResource); ! public ResourceEditorBean createResource(String uri, OntResource classResource); ! public ResourceEditorBean getResource(Resource resource); ! public Model getOntology(); - public Model getData(); } --- 51,67 ---- 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); ! public Resource createResource(String uri, OntResource classResource); ! ! public OntProperty[] getApplicableProperties(Resource resource); ! ! public Statement[] getDeclaredProperties(Resource resource); } Index: ResourceEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ResourceEditorBean.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ResourceEditorBean.java 18 Aug 2004 01:23:23 -0000 1.7 --- ResourceEditorBean.java 19 Aug 2004 14:45:31 -0000 1.8 *************** *** 21,30 **** import java.util.ArrayList; - import java.util.HashSet; import java.util.Iterator; import java.util.List; - import java.util.Set; - - import org.javaowl.editor.reasoner.EditorReasoner; import com.hp.hpl.jena.ontology.Individual; --- 21,26 ---- *************** *** 33,44 **** import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntResource; ! import com.hp.hpl.jena.rdf.model.Model; ! import com.hp.hpl.jena.rdf.model.ModelFactory; 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.rdf.model.Literal; - 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; --- 29,36 ---- 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; *************** *** 52,65 **** private final OntModel ontModel; - private final ModelEditorBean modelEditor; ! public ResourceEditorBean(Resource resource, String prefix, OntModel ontModel, ! ModelEditorBean modelEditor) { this.prefix = prefix; this.resource = resource; this.ontModel = ontModel; - this.modelEditor = modelEditor; ! InstanceClassification ic = getInstanceClassification(resource); for (Iterator it = ic.possibleIterator(); it.hasNext(); ) { String uri = (String) it.next(); --- 44,54 ---- 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(); ) { String uri = (String) it.next(); *************** *** 67,71 **** System.out.print(ic.isInferredClass(uri) ? "I" : "-"); System.out.println(" " + uri); ! } } --- 56,60 ---- System.out.print(ic.isInferredClass(uri) ? "I" : "-"); System.out.println(" " + uri); ! }*/ } *************** *** 73,160 **** return resource; } - - public OntProperty[] getApplicableProperties() { - Set props = new HashSet(); - InstanceClassification ic = getInstanceClassification(resource); - for (Iterator iter = ic.possibleIterator(); iter.hasNext(); ) { - String uri = (String) iter.next(); - if (ic.isDeclaredClass(uri) || ic.isInferredClass(uri)) { - OntClass resourceClass = ontModel.getOntClass(uri); - props.addAll(modelEditor.getPropertiesURIs(resourceClass, true)); - } - } - OntProperty[] result = new OntProperty[props.size()]; - int i = 0; - for (Iterator iter = props.iterator(); iter.hasNext(); ) { - String uri = (String) iter.next(); - result[i++] = ontModel.getOntProperty(uri); - } - return result; - } - public Statement[] getDeclaredProperties() { - List resources = new ArrayList(); - for (Iterator it = resource.listProperties(); it.hasNext();) { - Statement stmt = (Statement) it.next(); - if (stmt.getPredicate().getNameSpace().equals(prefix)) - resources.add(stmt); - } - return (Statement[]) resources.toArray(new Statement[0]); - } - public boolean isRequiredProperty(OntProperty property) { return false; } ! ! //TODO: get all valid Instances for the range intersection and the ! // resource restrictions ! public OntResource getValidLeafClass(Property property) { ! OntProperty op; ! if (property instanceof OntProperty) ! op = (OntProperty) property; ! else ! op = ontModel.createOntProperty(property.getURI()); ! List list = new ArrayList(); ! // TODO: fix this. Many ranges on a property implies an intersection... ! for (Iterator it = op.listRange(); it.hasNext();) { ! OntResource or = (OntResource) it.next(); ! OntClass oc = or.asClass(); ! Iterator it2 = oc.listSubClasses(); ! if (!it2.hasNext() && !or.getNameSpace().equals(XSD.xstring.getNameSpace())) ! list.add(or); ! } ! if (list.size() > 0) ! return (OntResource) list.get(0); ! return null; ! } ! ! public InstanceClassification getInstanceClassification(Resource instance) { ! EditorReasoner reasoner = new EditorReasoner(); ! Model model = ModelFactory.createDefaultModel(); ! model.add(modelEditor.getOntology()); ! model.add(modelEditor.getData()); ! try { ! reasoner.loadOntology(model); ! } catch (Exception e) { ! e.printStackTrace(); ! throw new RuntimeException("instance reasoner exception: ", e); ! } ! InstanceClassification result = new InstanceClassification(); ! Resource modelInstance = modelEditor.getData().getResource(instance.getURI()); ! for (StmtIterator iter = modelInstance.listProperties(RDF.type); iter.hasNext(); ) ! result.addDeclaredClass(iter.nextStatement().getObject().toString()); ! OntClass[] classes = modelEditor.getAllClasses(); ! for (int i = 0; i < classes.length; i++) { ! OntClass oc = classes[i]; ! String uri = oc.getURI(); ! if (!result.isDeclaredClass(uri) && reasoner.isType(instance, oc)) ! result.addInferredClass(uri); ! if (result.isDeclaredClass(uri) || result.isInferredClass(uri) || ! reasoner.canBeInstanceOf(instance, oc)) ! result.addPossibleClass(uri); ! } ! return result; ! } ! public Individual[] getValidObjects(OntResource resource) { List resources = new ArrayList(); --- 62,70 ---- return resource; } public boolean isRequiredProperty(OntProperty property) { return false; } ! public Individual[] getValidObjects(OntResource resource) { List resources = new ArrayList(); |
|
From: Elmer G. <ega...@us...> - 2004-08-18 01:23:47
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23532/src/org/javaowl/editor/remote Modified Files: RemoteModelEditor.java RemoteModelEditorWrapper.java Log Message: Work on remote model wrapper Index: RemoteModelEditorWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditorWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteModelEditorWrapper.java 17 Aug 2004 23:46:03 -0000 1.1 --- RemoteModelEditorWrapper.java 18 Aug 2004 01:23:24 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- 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; *************** *** 36,41 **** public class RemoteModelEditorWrapper implements ModelEditor { ! private Object remote; ! private Object name; public RemoteModelEditorWrapper(String name, RemoteModelEditor remote) { --- 37,43 ---- public class RemoteModelEditorWrapper implements ModelEditor { ! private RemoteModelEditor remote; ! private String name; ! private OntModel ontModel; public RemoteModelEditorWrapper(String name, RemoteModelEditor remote) { *************** *** 44,52 **** } ! /* (non-Javadoc) ! * @see org.javaowl.editor.ModelEditor#getAllClasses() ! */ ! public OntResource[] getAllClasses() { ! // TODO Auto-generated method stub return null; } --- 46,54 ---- } ! public OntClass[] getAllClasses() { ! String[] uris = remote.getAllClasses(); ! OntClass[] resources = new OntClass[uris.length]; ! for (int i = 0; i < uris.length; i++) ! resources[i] = ontModel.createClass(uris[i]); return null; } Index: RemoteModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote/RemoteModelEditor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteModelEditor.java 17 Aug 2004 23:46:03 -0000 1.1 --- RemoteModelEditor.java 18 Aug 2004 01:23:24 -0000 1.2 *************** *** 24,26 **** --- 24,31 ---- public interface RemoteModelEditor extends Remote{ + /** + * @return + */ + String[] getAllClasses(); + } |
|
From: Elmer G. <ega...@us...> - 2004-08-18 01:23:47
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23532/src/org/javaowl/editor Modified Files: ModelEditorBean.java ModelEditor.java ResourceEditorBean.java Log Message: Work on remote model wrapper Index: ModelEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditorBean.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ModelEditorBean.java 9 Aug 2004 19:07:31 -0000 1.10 --- ModelEditorBean.java 18 Aug 2004 01:23:23 -0000 1.11 *************** *** 56,60 **** private final String prefix; ! private OntResource[] classes; private EditorReasoner ontologyReasoner; --- 56,60 ---- private final String prefix; ! private OntClass[] classes; private EditorReasoner ontologyReasoner; *************** *** 89,93 **** } ! public OntResource[] getAllClasses() { return classes; } --- 89,93 ---- } ! public OntClass[] getAllClasses() { return classes; } *************** *** 231,238 **** OntClass oc = or.asClass(); if (prefix == null || oc.getNameSpace().equals(prefix)) { ! classes.add(or); } } ! this.classes = (OntResource[]) classes.toArray(new OntResource[0]); } } --- 231,238 ---- OntClass oc = or.asClass(); if (prefix == null || oc.getNameSpace().equals(prefix)) { ! classes.add(oc); } } ! this.classes = (OntClass[]) classes.toArray(new OntClass[0]); } } Index: ModelEditor.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ModelEditor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ModelEditor.java 17 Aug 2004 23:46:02 -0000 1.23 --- ModelEditor.java 18 Aug 2004 01:23:23 -0000 1.24 *************** *** 33,37 **** public interface ModelEditor { ! public OntResource[] getAllClasses(); public Set getPropertiesURIs(Resource clazz, boolean all); --- 33,37 ---- public interface ModelEditor { ! public OntClass[] getAllClasses(); public Set getPropertiesURIs(Resource clazz, boolean all); Index: ResourceEditorBean.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/ResourceEditorBean.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ResourceEditorBean.java 28 Jul 2004 07:17:03 -0000 1.6 --- ResourceEditorBean.java 18 Aug 2004 01:23:23 -0000 1.7 *************** *** 144,150 **** for (StmtIterator iter = modelInstance.listProperties(RDF.type); iter.hasNext(); ) result.addDeclaredClass(iter.nextStatement().getObject().toString()); ! OntResource[] classes = modelEditor.getAllClasses(); for (int i = 0; i < classes.length; i++) { ! OntClass oc = classes[i].asClass(); String uri = oc.getURI(); if (!result.isDeclaredClass(uri) && reasoner.isType(instance, oc)) --- 144,150 ---- for (StmtIterator iter = modelInstance.listProperties(RDF.type); iter.hasNext(); ) result.addDeclaredClass(iter.nextStatement().getObject().toString()); ! OntClass[] classes = modelEditor.getAllClasses(); for (int i = 0; i < classes.length; i++) { ! OntClass oc = classes[i]; String uri = oc.getURI(); if (!result.isDeclaredClass(uri) && reasoner.isType(instance, oc)) |
|
From: Elmer G. <ega...@us...> - 2004-08-17 23:46:24
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7281/src/org/javaowl/editor/remote Added Files: RemoteModelEditor.java RemoteModelEditorWrapper.java Log Message: Added remote model editor --- NEW FILE: RemoteModelEditorWrapper.java --- /* * RemoteModelEditorWrapper.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer * Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.remote; import java.util.Set; import org.javaowl.editor.ModelEditor; import org.javaowl.editor.ResourceEditorBean; import com.hp.hpl.jena.ontology.OntClass; 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.Model; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; public class RemoteModelEditorWrapper implements ModelEditor { private Object remote; private Object name; public RemoteModelEditorWrapper(String name, RemoteModelEditor remote) { this.remote = remote; this.name = name; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getAllClasses() */ public OntResource[] getAllClasses() { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getPropertiesURIs(com.hp.hpl.jena.rdf.model.Resource, boolean) */ public Set getPropertiesURIs(Resource clazz, boolean all) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getProperties(com.hp.hpl.jena.rdf.model.Resource, boolean) */ public OntProperty[] getProperties(Resource clazz, boolean all) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getAllDatatypeProperties() */ public OntProperty[] getAllDatatypeProperties() { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getInstances(com.hp.hpl.jena.ontology.OntResource, boolean) */ public Resource[] getInstances(OntResource clazz, boolean all) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getOntClass(com.hp.hpl.jena.rdf.model.Resource) */ public OntClass getOntClass(Resource resource) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getOntProperty(com.hp.hpl.jena.rdf.model.Property) */ public OntProperty getOntProperty(Property property) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getTypedLiteral(java.lang.Object, com.hp.hpl.jena.ontology.OntResource) */ public Literal getTypedLiteral(Object value, OntResource type) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#removeStatement(com.hp.hpl.jena.rdf.model.Statement) */ public void removeStatement(Statement statement) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#removeResource(com.hp.hpl.jena.rdf.model.Resource) */ public void removeResource(Resource resource) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getSubClasses(com.hp.hpl.jena.ontology.OntClass) */ public OntClass[] getSubClasses(OntClass resourceClass) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#createResource(com.hp.hpl.jena.ontology.OntResource) */ public ResourceEditorBean 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 ResourceEditorBean createResource(String uri, OntResource classResource) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getResource(com.hp.hpl.jena.rdf.model.Resource) */ public ResourceEditorBean getResource(Resource resource) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getOntology() */ public Model getOntology() { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.javaowl.editor.ModelEditor#getData() */ public Model getData() { // TODO Auto-generated method stub return null; } } --- NEW FILE: RemoteModelEditor.java --- /* * RemoteModelEditor.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer * Garduno Hernandez * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.editor.remote; import java.rmi.Remote; public interface RemoteModelEditor extends Remote{ } |
|
From: Elmer G. <ega...@us...> - 2004-08-17 23:46:24
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7281/src/org/javaowl/models/remote Modified Files: RemoteGraph.java Log Message: Added remote model editor Index: RemoteGraph.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraph.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RemoteGraph.java 17 Aug 2004 20:18:13 -0000 1.6 --- RemoteGraph.java 17 Aug 2004 23:46:02 -0000 1.7 *************** *** 22,40 **** import java.rmi.Remote; import java.rmi.RemoteException; - - import java.util.List; - - import com.hp.hpl.jena.graph.BulkUpdateHandler; - import com.hp.hpl.jena.graph.Capabilities; - import com.hp.hpl.jena.graph.Graph; - import com.hp.hpl.jena.graph.GraphEventManager; - import com.hp.hpl.jena.graph.Node; - import com.hp.hpl.jena.graph.Reifier; - import com.hp.hpl.jena.graph.TransactionHandler; - import com.hp.hpl.jena.graph.Triple; - import com.hp.hpl.jena.graph.TripleMatch; - import com.hp.hpl.jena.graph.query.QueryHandler; - import com.hp.hpl.jena.shared.PrefixMapping; - import com.hp.hpl.jena.util.iterator.ExtendedIterator; public interface RemoteGraph extends Remote { --- 22,25 ---- |