[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire docs/pegboard/swamp_rdf_api--tjl/peg.rs...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] fenfire docs/pegboard/swamp_rdf_api--tjl/peg.rs... |
Date: |
Sat, 12 Apr 2003 02:32:03 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Changes by: Tuomas J. Lukka <address@hidden> 03/04/12 02:32:02
Modified files:
docs/pegboard/swamp_rdf_api--tjl: peg.rst
org/fenfire/swamp: Graph.java
org/fenfire/swamp/impl: HashGraph.java
Added files:
org/fenfire/swamp: ObservableGraph.java ObservedGraph.java
__init__.py graphtest.py
org/fenfire/swamp/impl: __init__.py hashgraph.test
Log message:
More swamping
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/ObservableGraph.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/ObservedGraph.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/graphtest.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/Graph.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/impl/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/impl/hashgraph.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/swamp/impl/HashGraph.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst
diff -u fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst:1.8
fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst:1.9
--- fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst:1.8 Thu Apr 10
07:56:52 2003
+++ fenfire/docs/pegboard/swamp_rdf_api--tjl/peg.rst Sat Apr 12 02:32:02 2003
@@ -3,8 +3,8 @@
=============================================================
:Author: Tuomas J. Lukka
-:Last-Modified: $Date: 2003/04/10 11:56:52 $
-:Revision: $Revision: 1.8 $
+:Last-Modified: $Date: 2003/04/12 06:32:02 $
+:Revision: $Revision: 1.9 $
:Status: Current, Partially preliminarily implemented (since in its own
package)
This document outlines the main issues in the Jena api
@@ -184,8 +184,8 @@
by mudyc: What's the meaning of Resource Mapper?
tjl: Resource Mapper is used in special cases, i.e.,
- too different rdf spaces is diffed.
- Now we can map the single resource between them.
+ when two different rdf spaces are diffed.
+ Now we can share the single resource between them.
mudyc: So it has nothing to do with Literals?
tjl: No.
@@ -206,20 +206,21 @@
public static void appendToString(Object res, StringBuffer buf);
}
-The appendToString method solves one problem we had in Gzz:
-when saving, too many Strings were created for object names. Similarly, having
-the toModel method overloaded with different parameter types allows the most
efficient
-creation of resources without conversions.
+The appendToString method solves one problem we had in Gzz: when saving,
+too many Strings were created for object names. Similarly, having the
+toModel method overloaded with different parameter types allows the most
+efficient creation of resources without conversions.
-We *may* want to make Nodes internally redirectable in the future to allow
-alternate implementations; the static interface will not change.
+We *may* want to make Nodes internally redirectable in the future to
+allow alternate implementations; the static interface will not change.
-The model object
+The graph object
----------------
-The ShortRDF class shows what a mess the query functions can easily become.
-To avoid this, we'll drop the semantics (subject,predicate,object) for now
-and name all methods according to a general scheme. ::
+The ShortRDF class shows what a mess the query functions
+can easily become. To avoid this, we'll drop the semantics
+(subject,predicate,object) for now and name all methods according to a
+general scheme. ::
public interface ConstGraph {
Object find1_11X(Object subject, Object predicate);
@@ -248,16 +249,16 @@
first, the actual function type:
find1
- Find a *single* triple fitting the given parts and return the part
- marked X. If there is none, null is returned. If there are more than
- one, an exception is thrown.
+ Find a *single* triple fitting the given parts and return the
+ part marked X. If there is none, null is returned. If there are
+ more than one, an exception is thrown.
Only a single X may be used.
findN
- Return an iterator iterating through the triples fitting the given
parts,
- and return. Even if there are none, the iterator is created.
- Only a single X may be used.
+ Return an iterator iterating through the triples fitting the
+ given parts, and return. Even if there are none, the iterator
+ is created. Only a single X may be used.
For instance, ::
@@ -270,18 +271,19 @@
finds all nodes that are the subject of any triple.
set1
- Remove the other occurrences of the matching triples, replace them with
the given
- new one. For example, if triples (a,b,c) and (a,b,d) and (a,e,d) are in
the model,
- then after ::
+ Remove the other occurrences of the matching triples, replace
+ them with the given new one. For example, if triples (a,b,c)
+ and (a,b,d) and (a,e,d) are in the model, then after ::
set1_11X(a, b, g)
- the model will have the triples (a,b,g) and (a,e,d).
- Only a single X may be used (restriction may be lifted in the future).
- Only 1 and X may be used.
-
+ the model will have the triples (a,b,g) and (a,e,d). Only a
+ single X may be used (restriction may be lifted in the future).
+ Only 1 and X may be used.
+
rm
- Remove the matching triples from the model. Any amount of Xs may be
used.
+ Remove the matching triples from the model. Any amount of Xs
+ may be used.
and, after an underscore, the parameter scheme:
@@ -306,5 +308,28 @@
}
The wildcards are set to null.
+
+Observing
+---------
+
+Observing is separated into its own interface.:
+
+ public interface ObservableGraph extends ConstGraph {
+ public ObservedGraph getObserved(Obs o);
+
+ Object find1_11X(Object subject, Object predicate, Obs o);
+ Object find1_X11(Object predicate, Object subject, Obs o);
+ ...
+ Iterator findN_11X_Iter(Object subject, Object predicate, Obs o);
+ ...
+ }
+
+ public interface ObservedGraph extends ConstGraph {
+ /** This observed graph will not be used any more, and
+ * if desired, may be recycled by the ObservableGraph.
+ * This operation is allowed to be a no-op.
+ */
+ public void close();
+ }
Index: fenfire/org/fenfire/swamp/Graph.java
diff -u fenfire/org/fenfire/swamp/Graph.java:1.1
fenfire/org/fenfire/swamp/Graph.java:1.2
--- fenfire/org/fenfire/swamp/Graph.java:1.1 Thu Apr 10 07:56:52 2003
+++ fenfire/org/fenfire/swamp/Graph.java Sat Apr 12 02:32:02 2003
@@ -2,6 +2,8 @@
package org.fenfire.swamp;
+/** A modifiable RDF graph.
+ */
public interface Graph extends ConstGraph {
void set1_11X(Object subject, Object predicate, Object object);
// void rm_1XX(Object subject);
Index: fenfire/org/fenfire/swamp/impl/HashGraph.java
diff -u fenfire/org/fenfire/swamp/impl/HashGraph.java:1.1
fenfire/org/fenfire/swamp/impl/HashGraph.java:1.2
--- fenfire/org/fenfire/swamp/impl/HashGraph.java:1.1 Thu Apr 10 07:56:52 2003
+++ fenfire/org/fenfire/swamp/impl/HashGraph.java Sat Apr 12 02:32:02 2003
@@ -8,7 +8,7 @@
import java.util.ArrayList;
import java.util.Iterator;
-/** A Graph implemented by HashMaps.
+/** An RDF Graph implemented by HashMaps.
* Relatively inefficient but a basic implementation
* that can be used as a reference.
*/
@@ -16,7 +16,7 @@
/** Map: key = subject, value = (Map: key=predicate, value =
* (Set: r/l)).
*/
- private HashMap spo;
+ private HashMap spo = new HashMap();
private HashSet emptySet = new HashSet();
@@ -63,7 +63,7 @@
public void set1_11X(Object subject, Object predicate, Object object) {
rm_11X(subject, predicate);
- get_HHS(true, spo, subject, predicate).add(object);
+ add(subject, predicate, object);
}
public void rm_11X(Object subject, Object predicate) {
@@ -78,6 +78,10 @@
HashSet s = get_HHS(false, spo, subject, predicate);
if(s == null) return;
s.remove(object);
+ }
+
+ public void add(Object subject, Object predicate, Object object) {
+ get_HHS(true, spo, subject, predicate).add(object);
}
}