[graphl-cvs] graphl/src/org/mediavirus/graphl/graph/rdf RDFNode.java RDFGraph.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-09-07 12:30:16
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25832/src/org/mediavirus/graphl/graph/rdf Modified Files: RDFNode.java RDFGraph.java Log Message: - FEATURE: type menu pops up upon edge creation - BUG: fixed assignment of unique ids to new nodes - BUG: fixed in-place editor for nodes - CODE: loading graphs is now synchronized to avoid loading conflicts - CODE: restoring Graphics transform in GraphlPane after rendering Index: RDFNode.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RDFNode.java 5 Sep 2005 15:41:23 -0000 1.10 --- RDFNode.java 7 Sep 2005 12:29:55 -0000 1.11 *************** *** 12,15 **** --- 12,16 ---- import org.mediavirus.graphl.graph.DefaultNode; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.vocabulary.NS; /** *************** *** 47,50 **** --- 48,65 ---- } + public void setId(String id) { + // if a #genid is set, set global number higher than that to avoid duplicates + if (id.contains("#genid")) { + try { + int idnum = Integer.parseInt(id.substring(id.lastIndexOf("#genid")+6)); + if (idnum >= num) num = idnum+1; + } + catch (NumberFormatException nfex) { + // do nothing + } + } + super.setId(id); + } + public String getType() { Node n = getFirstNeighbour("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", true); *************** *** 71,74 **** --- 86,91 ---- RDFEdge typeEdge = new RDFEdge(this, typeNode); typeEdge.setType("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + // TODO (3) this should probably not be hardcoded to USER + typeEdge.setSource(NS.graphl + "USER"); graph.addElements(null, Collections.singleton(typeEdge)); } catch (Exception e) { Index: RDFGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFGraph.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RDFGraph.java 5 Sep 2005 15:40:08 -0000 1.11 --- RDFGraph.java 7 Sep 2005 12:29:55 -0000 1.12 *************** *** 126,130 **** } ! public void readFromFile(String filename) throws IOException { System.out.println("reading file " + filename); File f = new File(filename); --- 126,130 ---- } ! public synchronized void readFromFile(String filename) throws IOException { System.out.println("reading file " + filename); File f = new File(filename); *************** *** 150,154 **** } ! public void readFromURL(URL url){ loadingURL = url; --- 150,154 ---- } ! public synchronized void readFromURL(URL url){ loadingURL = url; *************** *** 317,321 **** public Edge createEdge(Node from, Node to) { RDFEdge edge = new RDFEdge(from, to); ! edge.setSource(loadingURL.toString()); addElements(null, Collections.singleton(edge)); return edge; --- 317,326 ---- public Edge createEdge(Node from, Node to) { RDFEdge edge = new RDFEdge(from, to); ! if (loadingURL != null) { ! edge.setSource(loadingURL.toString()); ! } ! else { ! edge.setSource(NS.graphl + "USER"); ! } addElements(null, Collections.singleton(edge)); return edge; |