/[fenfire]/fenfire/org/fenfire/util/RDFUtil.java
ViewVC logotype

Diff of /fenfire/org/fenfire/util/RDFUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by tjl, Sun May 11 16:10:21 2003 UTC revision 1.12 by mudyc, Fri May 23 14:26:07 2003 UTC
# Line 15  public class RDFUtil { Line 15  public class RDFUtil {
15    
16      /** Create a new resource with given type.      /** Create a new resource with given type.
17       */       */
18      static public Object N(Fen fen, Object type) {      static public Object N(Graph graph, Object type) {
19          Object obj = Nodes.N();          Object obj = Nodes.N();
20          fen.graph.add(obj, RDF.type, type);          graph.add(obj, RDF.type, type);
21    
22          if(dbg) {          if(dbg) {
23              p("N: "+fen+" "+fen.graph+" "+fen.constgraph+              p("N: "+graph+" "+obj+" "+type);
24                " "+obj+" "+type);              if (!isNodeType(graph, obj, type)) throw new Error("Impossible!");
             if (!isNodeType(fen, obj, type)) throw new Error("Impossible!");  
25          }          }
26    
27          return obj;          return obj;
# Line 31  public class RDFUtil { Line 30  public class RDFUtil {
30    
31      /** Check if node is the type which is asked.      /** Check if node is the type which is asked.
32       */       */
33      static public boolean isNodeType(Fen fen, Object node, Object type) {      static public boolean isNodeType(Graph graph, Object node, Object type) {
34          if(dbg) p("Isnodetype: "+node+" "+type);          if(dbg) p("Isnodetype: "+node+" "+type);
35          Iterator it = fen.constgraph.findN_11X_Iter(node, RDF.type);          Iterator it = graph.findN_11X_Iter(node, RDF.type);
36          while(it.hasNext()) {          while(it.hasNext()) {
37              Object obj = it.next();              Object obj = it.next();
38              if(dbg) p(" entry: "+ obj);              if(dbg) p(" entry: "+ obj);
# Line 45  public class RDFUtil { Line 44  public class RDFUtil {
44    
45      /** Get int attribute (from a literal).      /** Get int attribute (from a literal).
46       */       */
47      static public int getInt(Fen fen, Object node, Object pre) {      static public int getInt(Graph graph, Object node, Object pre) {
48          Literal lit = (Literal)fen.constgraph.find1_11X(node, pre);          Literal lit = (Literal)graph.find1_11X(node, pre);
49          return Integer.parseInt(lit.getTextString() );          return Integer.parseInt(lit.getTextString() );
50      }      }
51    
52      /** Set int attribute (literal).      /** Set int attribute (literal).
53       */       */
54      static public void setInt(Fen fen, Object node, Object pre, int val) {      static public void setInt(Graph graph, Object node, Object pre, int val) {
55          fen.graph.set1_11X(node, pre,          graph.set1_11X(node, pre,
56                  Nodes.getStringLiteral(                  Nodes.getStringLiteral(
57                      Integer.toString(val)));                      Integer.toString(val)));
58      }      }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26