[graphl-cvs] graphl/src/org/mediavirus/graphl/graph/rdf RDFGraph.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-08-24 16:10:30
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6025/src/org/mediavirus/graphl/graph/rdf Modified Files: RDFGraph.java Log Message: fixed assignment of id's to nodes (now using full URL) Index: RDFGraph.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/graph/rdf/RDFGraph.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RDFGraph.java 17 Aug 2005 15:52:53 -0000 1.9 --- RDFGraph.java 24 Aug 2005 16:10:22 -0000 1.10 *************** *** 99,102 **** --- 99,103 ---- public void readFromFile(String filename) throws IOException { + System.out.println("reading file " + filename); File f = new File(filename); try { *************** *** 171,174 **** --- 172,191 ---- //if (predicate.equals(NS.graphl + "connectedTo")) { // get / create node with label subject + + if (loadingURL != null) { + try { + subject = new URL(loadingURL, subject).toString(); + } + catch (MalformedURLException muex) { + // do nothing + } + try { + object = new URL(loadingURL, object).toString(); + } + catch (MalformedURLException muex) { + // do nothing + } + } + Node snode; Node onode; *************** *** 198,204 **** if (predicate.equals("http://www.w3.org/2002/07/owl#imports")) { - System.out.println("#### " + object); try { URL oldBase = loadingURL; URL importURL = new URL(loadingURL, object); System.out.println("importing " + importURL.toString() + " ... "); --- 215,221 ---- if (predicate.equals("http://www.w3.org/2002/07/owl#imports")) { try { URL oldBase = loadingURL; + Node oldSource = sourceNode; URL importURL = new URL(loadingURL, object); System.out.println("importing " + importURL.toString() + " ... "); *************** *** 206,209 **** --- 223,227 ---- // restore original base url loadingURL = oldBase; + sourceNode = oldSource; } catch (MalformedURLException muex) { *************** *** 271,296 **** // TODO (2): for incremental loading, check if these things are already set ! if (predicate.equals(NS.graphl + "canvasPosition")) { ! RDFNode snode = getNodeById(subject); ! if (snode != null){ ! double x = Double.parseDouble(object.substring(0,object.indexOf(':'))); ! double y = Double.parseDouble(object.substring(object.indexOf(':')+1)); ! snode.setCenter(x,y); ! } ! } ! else { ! //if (predicate.equals(NS.graphl + "connectedTo")) { ! // get / create node with label subject ! Node snode; try { ! snode = getNodeOrNew(subject); ! snode.setProperty(predicate, object); ! if (DEBUG) System.out.println("created property " + subject + ", " + predicate + ", " + object); } ! catch (Exception ex) { ! if (DEBUG) System.out.println("Error while reading triple: " + subject + ", " + predicate + ", " + object); ! // ex.printStackTrace(); } } } --- 289,313 ---- // TODO (2): for incremental loading, check if these things are already set ! //if (predicate.equals(NS.graphl + "connectedTo")) { ! // get / create node with label subject ! ! if (loadingURL != null) { try { ! subject = new URL(loadingURL, subject).toString(); } ! catch (MalformedURLException muex) { ! // do nothing } } + + Node snode; + try { + snode = getNodeOrNew(subject); + snode.setProperty(predicate, object); + if (DEBUG) System.out.println("created property " + subject + ", " + predicate + ", " + object); + } + catch (Exception ex) { + if (DEBUG) System.out.println("Error while reading triple: " + subject + ", " + predicate + ", " + object); + } } |