Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1692/src/org/javaowl/models/remote
Modified Files:
RemoteGraph.java RemoteGraphWrapper.java
Added Files:
SerializableTriple.java
Log Message:
More changes in remote graph.
Index: RemoteGraphWrapper.java
===================================================================
RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraphWrapper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RemoteGraphWrapper.java 11 Aug 2004 02:06:04 -0000 1.4
--- RemoteGraphWrapper.java 17 Aug 2004 20:18:13 -0000 1.5
***************
*** 22,25 ****
--- 22,26 ----
import java.rmi.RemoteException;
import java.util.List;
+ import java.util.ArrayList;
import java.util.Iterator;
import com.hp.hpl.jena.graph.BulkUpdateHandler;
***************
*** 37,41 ****
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;
--- 38,42 ----
import com.hp.hpl.jena.shared.PrefixMapping;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
! import com.hp.hpl.jena.util.iterator.WrappedIterator;
import com.hp.hpl.jena.graph.GraphUtil;
***************
*** 66,78 ****
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);
--- 67,84 ----
return contains(triple.getSubject(), triple.getPredicate(), triple.getObject());
}
!
public ExtendedIterator find(Node subject, Node predicate, Node object) {
try {
! SerializableTriple[] triples = remote.find(name,
! TripleUtil.nodeToString(subject),
! TripleUtil.nodeToString(predicate),
! TripleUtil.nodeToString(object));
! List result = new ArrayList();
! for (int i = 0 ; i < triples.length; i++) {
! result.add(new Triple(TripleUtil.stringToNode(triples[i].getSubject()),
! TripleUtil.stringToNode(triples[i].getPredicate()),
! TripleUtil.stringToNode(triples[i].getObject())));
! }
! return WrappedIterator.create(result.iterator());
} catch (RemoteException e) {
throw new RuntimeException(e);
***************
*** 197,205 ****
public PrefixMapping getPrefixMapping() {
! throw new UnsupportedOperationException();
}
public Reifier getReifier() {
! throw new UnsupportedOperationException();
}
--- 203,212 ----
public PrefixMapping getPrefixMapping() {
! return PrefixMapping.Factory.create();
}
public Reifier getReifier() {
! return null;
! //throw new UnsupportedOperationException();
}
Index: RemoteGraph.java
===================================================================
RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/models/remote/RemoteGraph.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RemoteGraph.java 11 Aug 2004 02:06:04 -0000 1.5
--- RemoteGraph.java 17 Aug 2004 20:18:13 -0000 1.6
***************
*** 45,52 ****
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;
--- 45,54 ----
public void delete(String name, String subject, String predicate, String object)
throws RemoteException;
! public SerializableTriple[] 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 void removeGraph(String name) throws RemoteException;
+ public void dump(String name) throws RemoteException;
//public boolean dependsOn(String name, String graph) throws RemoteException;
--- 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.models.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;
}
}
|