/[fenfire]/fenfire/org/fenfire/swamp/Graphs.java
ViewVC logotype

Diff of /fenfire/org/fenfire/swamp/Graphs.java

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

revision 1.8 by benja, Thu Jun 5 18:36:19 2003 UTC revision 1.9 by tjl, Fri Jun 6 20:04:33 2003 UTC
# Line 32  import com.hp.hpl.mesa.rdf.jena.mem.*; Line 32  import com.hp.hpl.mesa.rdf.jena.mem.*;
32  import java.util.Iterator;  import java.util.Iterator;
33    
34  public class Graphs {  public class Graphs {
35      public static boolean dbg = true;      public static boolean dbg = false;
36      public static void p(String s) { System.out.println("swamp.Graphs:: "+s); }      public static void p(String s) { System.out.println("swamp.Graphs:: "+s); }
37    
38      public static Model toModel(ConstGraph g) {      public static Model toModel(ConstGraph g) {
# Line 53  public class Graphs { Line 53  public class Graphs {
53                      for (Iterator k=g.findN_11X_Iter(o,p); k.hasNext();) {                      for (Iterator k=g.findN_11X_Iter(o,p); k.hasNext();) {
54                          Object q = k.next();                          Object q = k.next();
55                          if(q instanceof Literal) {                                if(q instanceof Literal) {      
56                              p("Literal! : "+ q);                              if(dbg)
57                                    p("Literal! : "+ q);
58                              String s = ((Literal)q).getTextString();                              String s = ((Literal)q).getTextString();
59                              sub.addProperty(prop, s);                              sub.addProperty(prop, s);
60                          } else {                          } else {
61                              p("Resource! : "+ q);                              if(dbg)
62                                    p("Resource! : "+ q);
63                              Resource ob = m.createResource(Nodes.toString(q));                              Resource ob = m.createResource(Nodes.toString(q));
64                              sub.addProperty(prop, o);                              sub.addProperty(prop, o);
65                          }                          }
# Line 73  public class Graphs { Line 75  public class Graphs {
75      public static Graph toGraph(Model m) {      public static Graph toGraph(Model m) {
76          try {          try {
77              if (dbg) {              if (dbg) {
78                  p("toGraph!");                  p("toGraph!");
79                  StmtIterator j=m.listStatements();                  StmtIterator j=m.listStatements();
80                  while(j.hasNext()) {                  while(j.hasNext()) {
81                      p("And there are: "+                      p("And there are: "+
82                        ((Statement)j.next()).getString() );                        ((Statement)j.next()).getString() );
83                  }                  }
84              }              }
# Line 87  public class Graphs { Line 89  public class Graphs {
89                  Statement s = i.next();                  Statement s = i.next();
90                  Object sub = Nodes.get(s.getSubject().toString());                  Object sub = Nodes.get(s.getSubject().toString());
91                  Object pred = Nodes.get(s.getPredicate().toString());                  Object pred = Nodes.get(s.getPredicate().toString());
92                  System.out.println("PRED: '"+s.getPredicate().toString()+"'");                  if(dbg)
93                        p("PRED: '"+s.getPredicate().toString()+"'");
94                  if(s.getObject() instanceof com.hp.hpl.mesa.rdf.jena.model.Literal) {                  if(s.getObject() instanceof com.hp.hpl.mesa.rdf.jena.model.Literal) {
95                      Literal ob = Nodes.getStringLiteral(s.getString());                      Literal ob = Nodes.getStringLiteral(s.getString());
96                      g.add(sub, pred, ob);                      g.add(sub, pred, ob);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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