/[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.5 by tjl, Tue Apr 15 17:53:33 2003 UTC revision 1.6 by mudyc, Tue Apr 15 18:09:18 2003 UTC
# Line 7  import org.fenfire.vocab.*; Line 7  import org.fenfire.vocab.*;
7  import java.util.Iterator;  import java.util.Iterator;
8    
9  public class RDFUtil {  public class RDFUtil {
10      public static boolean dbg = true;      public static boolean dbg = false;
11        static private void p(String s) { if (dbg) pa(s); }
12      static private void pa(String s) { System.out.println("RDFUtil: "+s); }      static private void pa(String s) { System.out.println("RDFUtil: "+s); }
13    
14      /** Create a new resource with given type.      /** Create a new resource with given type.
# Line 16  public class RDFUtil { Line 17  public class RDFUtil {
17          Object obj = Nodes.N();          Object obj = Nodes.N();
18          fen.graph.set1_11X(obj, RDF.type, type);          fen.graph.set1_11X(obj, RDF.type, type);
19    
20          if(dbg) pa("N: "+fen+" "+fen.graph+" "+fen.constgraph+          p("N: "+fen+" "+fen.graph+" "+fen.constgraph+
21                      " "+obj+" "+type);            " "+obj+" "+type);
22    
23          if (!isNodeType(fen, obj, type)) throw new Error("Impossible!");          if (!isNodeType(fen, obj, type)) throw new Error("Impossible!");
24    
# Line 28  public class RDFUtil { Line 29  public class RDFUtil {
29      /** Check if node is the type which is asked.      /** Check if node is the type which is asked.
30       */       */
31      static public boolean isNodeType(Fen fen, Object node, Object type) {      static public boolean isNodeType(Fen fen, Object node, Object type) {
32          if(dbg) pa("Isnodetype: "+node+" "+type);          p("Isnodetype: "+node+" "+type);
33          Iterator it = fen.constgraph.findN_11X_Iter(node, RDF.type);          Iterator it = fen.constgraph.findN_11X_Iter(node, RDF.type);
34          while(it.hasNext()) {          while(it.hasNext()) {
35              Object obj = it.next();              Object obj = it.next();
36              pa(" entry: "+ obj);              p(" entry: "+ obj);
37              if ( obj.equals(type) ) return true;              if ( obj.equals(type) ) return true;
38          }          }
39          pa("None matched");          p("None matched");
40          return false;          return false;
41      }      }
42    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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