|
From: Elmer G. <ega...@us...> - 2004-08-11 02:06:14
|
Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18976/src/org/javaowl/models/remote Modified Files: RemoteGraph.java RemoteGraphWrapper.java Log Message: Changes in remote interface. Index: RemoteGraphWrapper.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraphWrapper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RemoteGraphWrapper.java 9 Aug 2004 20:59:52 -0000 1.3 --- RemoteGraphWrapper.java 11 Aug 2004 02:06:04 -0000 1.4 *************** *** 21,25 **** import java.rmi.RemoteException; ! import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; --- 21,26 ---- import java.rmi.RemoteException; ! import java.util.List; ! import java.util.Iterator; import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; *************** *** 36,170 **** import com.hp.hpl.jena.shared.PrefixMapping; import com.hp.hpl.jena.util.iterator.ExtendedIterator; ! public class RemoteGraphWrapper implements Graph { ! private RemoteGraph remote; ! public void add(Triple triple) throws AddDeniedException{ ! try { ! remote.add(triple); ! } catch (RemoteException e) { ! throw new AddDeniedException(e.toString()); ! } ! } ! public void close() { ! try { ! remote.close(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } } public boolean contains(Node subject, Node predicate, Node object) { try { ! return remote.contains(subject, predicate, object); } catch (RemoteException e) { throw new RuntimeException(e); } } public boolean contains(Triple triple) { try { ! return remote.contains(triple); } catch (RemoteException e) { throw new RuntimeException(e); } } ! public void delete(Triple triple) throws DeleteDeniedException { ! try { ! remote.delete(triple); ! } catch (RemoteException e) { ! throw new DeleteDeniedException(e.toString()); ! } } ! public boolean dependsOn(Graph graph) { try { ! return remote.dependsOn(graph); } catch (RemoteException e) { throw new RuntimeException(e); } } ! public ExtendedIterator find(Node subject, Node predicate, Node object) { try { ! return remote.find(subject, predicate, object); } catch (RemoteException e) { throw new RuntimeException(e); } } ! public ExtendedIterator find(TripleMatch tripleMatch) { try { ! return remote.find(tripleMatch); } catch (RemoteException e) { throw new RuntimeException(e); } } public BulkUpdateHandler getBulkUpdateHandler() { ! try { ! return remote.getBulkUpdateHandler(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } } ! public Capabilities getCapabilities() { try { ! return remote.getCapabilities(); } catch (RemoteException e) { ! throw new RuntimeException(e); } } ! public GraphEventManager getEventManager() { ! try { ! return remote.getEventManager(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); } } ! public PrefixMapping getPrefixMapping() { ! try { ! return remote.getPrefixMapping(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } } ! public Reifier getReifier() { ! try { ! return remote.getReifier(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); } } ! public TransactionHandler getTransactionHandler() { try { ! return remote.getTransactionHandler(); } catch (RemoteException e) { ! throw new RuntimeException(e); } } ! public boolean isEmpty() { ! try { ! return remote.isEmpty(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); } } public boolean isIsomorphicWith(Graph graph) { ! try { ! return remote.isIsomorphicWith(graph); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } } public QueryHandler queryHandler() { ! try { ! return remote.queryHandler(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } ! } ! public int size() { ! try { ! return remote.size(); ! } catch (RemoteException e) { ! throw new RuntimeException(e); ! } } } --- 37,217 ---- import com.hp.hpl.jena.shared.PrefixMapping; import com.hp.hpl.jena.util.iterator.ExtendedIterator; + import com.hp.hpl.jena.graph.TripleMatchIterator; + import com.hp.hpl.jena.graph.GraphUtil; + import org.javaowl.models.prevalence.TripleUtil; ! public class RemoteGraphWrapper implements Graph, BulkUpdateHandler { ! private final RemoteGraph remote; ! private final String name; ! public RemoteGraphWrapper(String name, RemoteGraph remote) { ! this.remote = remote; ! this.name = name; } + public boolean contains(Node subject, Node predicate, Node object) { try { ! return remote.contains(name, ! TripleUtil.nodeToString(subject), ! TripleUtil.nodeToString(predicate), ! TripleUtil.nodeToString(object)); } catch (RemoteException e) { throw new RuntimeException(e); } } + public boolean contains(Triple triple) { + return contains(triple.getSubject(), triple.getPredicate(), triple.getObject()); + } + + public ExtendedIterator find(Node subject, Node predicate, Node object) { try { ! return new TripleMatchIterator(new Triple(subject, predicate, object), ! remote.find(name, ! TripleUtil.nodeToString(subject), ! TripleUtil.nodeToString(predicate), ! TripleUtil.nodeToString(object)). ! iterator()); } catch (RemoteException e) { throw new RuntimeException(e); } } ! ! public ExtendedIterator find(TripleMatch triple) { ! return find(triple.asTriple().getSubject(), ! triple.asTriple().getPredicate(), ! triple.asTriple().getObject()); } ! ! public boolean isEmpty() { try { ! return remote.isEmpty(name); } catch (RemoteException e) { throw new RuntimeException(e); } } ! ! public int size() { try { ! return remote.size(name); } catch (RemoteException e) { throw new RuntimeException(e); } } ! ! public void close() { try { ! remote.close(name); } catch (RemoteException e) { throw new RuntimeException(e); } } + public BulkUpdateHandler getBulkUpdateHandler() { ! return this; } ! ! public void add(Triple triple) throws AddDeniedException{ try { ! remote.add(name, ! TripleUtil.nodeToString(triple.getSubject()), ! TripleUtil.nodeToString(triple.getPredicate()), ! TripleUtil.nodeToString(triple.getObject())); } catch (RemoteException e) { ! throw new AddDeniedException(e.toString()); } } ! ! public void add(Triple[] triples) { ! for (int i = 0; i < triples.length; i++) { ! add(triples[i]); } } ! ! public void add(List triples) { ! add(triples.iterator()); } ! ! public void add(Iterator it) { ! while (it.hasNext()) { ! add((Triple) it.next()); } } ! ! public void add(Graph graph, boolean withReifications) { ! add(GraphUtil.findAll(graph)); ! } ! ! public void add(Graph graph) { ! add(graph, false); ! } ! ! public void delete(Triple triple) throws DeleteDeniedException { try { ! remote.delete(name, ! TripleUtil.nodeToString(triple.getSubject()), ! TripleUtil.nodeToString(triple.getPredicate()), ! TripleUtil.nodeToString(triple.getObject())); } catch (RemoteException e) { ! throw new DeleteDeniedException(e.toString()); } } ! ! public void delete(Triple[] triples) { ! for (int i = 0; i < triples.length; i++) { ! delete(triples[i]); } } + + public void delete(List triples) { + delete(triples.iterator()); + } + + public void delete(Iterator it) { + while (it.hasNext()) { + delete((Triple) it.next()); + } + } + + public void delete(Graph graph) { + delete(graph, false); + } + + public void delete(Graph graph, boolean withReifications) { + delete(GraphUtil.findAll(graph)); + } + + public boolean dependsOn(Graph graph) { + throw new UnsupportedOperationException(); + } + + public Capabilities getCapabilities() { + throw new UnsupportedOperationException(); + } + + public GraphEventManager getEventManager() { + throw new UnsupportedOperationException(); + } + + public PrefixMapping getPrefixMapping() { + throw new UnsupportedOperationException(); + } + + public Reifier getReifier() { + throw new UnsupportedOperationException(); + } + + public TransactionHandler getTransactionHandler() { + throw new UnsupportedOperationException(); + } + public boolean isIsomorphicWith(Graph graph) { ! throw new UnsupportedOperationException(); } + public QueryHandler queryHandler() { ! throw new UnsupportedOperationException(); } } Index: RemoteGraph.java =================================================================== RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraph.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RemoteGraph.java 9 Aug 2004 20:59:52 -0000 1.4 --- RemoteGraph.java 11 Aug 2004 02:06:04 -0000 1.5 *************** *** 23,26 **** --- 23,28 ---- import java.rmi.RemoteException; + import java.util.List; + import com.hp.hpl.jena.graph.BulkUpdateHandler; import com.hp.hpl.jena.graph.Capabilities; *************** *** 37,57 **** public interface RemoteGraph extends Remote { ! public boolean dependsOn(Graph graph) throws RemoteException; ! public QueryHandler queryHandler() throws RemoteException; ! public TransactionHandler getTransactionHandler() throws RemoteException; ! public BulkUpdateHandler getBulkUpdateHandler() throws RemoteException; ! public Capabilities getCapabilities() throws RemoteException; ! public GraphEventManager getEventManager() throws RemoteException; ! public Reifier getReifier() throws RemoteException; ! public PrefixMapping getPrefixMapping() throws RemoteException; ! public void delete(Triple triple) throws RemoteException; ! public ExtendedIterator find(TripleMatch tripleMatch) throws RemoteException; ! public ExtendedIterator find(Node subject, Node predicate, Node object) throws RemoteException; ! public boolean isIsomorphicWith(Graph graph) throws RemoteException; ! public boolean contains(Node subject, Node predicate, Node object) throws RemoteException; ! public boolean contains(Triple triple) throws RemoteException; ! public void close() throws RemoteException; ! public boolean isEmpty() throws RemoteException; ! public int size() throws RemoteException; ! public void add(Triple triple) throws RemoteException; } --- 39,64 ---- public interface RemoteGraph extends Remote { ! ! ! public void add(String name, String subject, String predicate, String object) ! throws RemoteException; ! public void delete(String name, String subject, String predicate, String object) ! throws RemoteException; ! public List find(String name, String subject, String predicate, String object) ! throws RemoteException; ! public boolean contains(String name, String subject, String predicate, String object) ! throws RemoteException; ! ! //public boolean dependsOn(String name, String graph) throws RemoteException; ! //public QueryHandler queryHandler() throws RemoteException; ! //public TransactionHandler getTransactionHandler() throws RemoteException; ! //public BulkUpdateHandler getBulkUpdateHandler() throws RemoteException; ! //public Capabilities getCapabilities() throws RemoteException; ! //public GraphEventManager getEventManager() throws RemoteException; ! //public Reifier getReifier() throws RemoteException; ! //public PrefixMapping getPrefixMapping() throws RemoteException; ! //public boolean isIsomorphicWith(String name, String graph) throws RemoteException; ! public void close(String name) throws RemoteException; ! public boolean isEmpty(String name) throws RemoteException; ! public int size(String name) throws RemoteException; } |