public void prepareNamespaces(Marshaller m, Document document) throws PropertyException { final Namespace superNamespace = NamespaceGatherer.accumulateAllNamespaces(document); configurePrefixes(m,superNamespace); Namespace.withThreadNamespace(superNamespace); }
public Document doAction(Document doc) { List<Bundle> bRecords = new LinkedList<Bundle>(); List<Statement> sRecords = new LinkedList<Statement>(); Namespace docNamespace=doc.getNamespace(); Namespace.withThreadNamespace(docNamespace); c.startDocument(doc.getNamespace()); for (Statement s : u.getStatement(doc)) { sRecords.add((Statement) u.doAction(s, this)); } for (Bundle bu : u.getNamedBundle(doc)) { Namespace.withThreadNamespace(new Namespace(docNamespace)); Bundle o = doAction(bu,u); if (o != null) bRecords.add(o); } return c.newDocument(doc.getNamespace(), sRecords, bRecords); }
public Document doAction(Document doc) { List<Bundle> bRecords = new LinkedList<Bundle>(); List<Statement> sRecords = new LinkedList<Statement>(); Namespace docNamespace=doc.getNamespace(); Namespace.withThreadNamespace(docNamespace); c.startDocument(doc.getNamespace()); for (Statement s : u.getStatement(doc)) { sRecords.add((Statement) u.doAction(s, this)); } for (Bundle bu : u.getNamedBundle(doc)) { Namespace.withThreadNamespace(new Namespace(docNamespace)); Bundle o = doAction(bu,u); if (o != null) bRecords.add(o); } return c.newDocument(doc.getNamespace(), sRecords, bRecords); }
public void writeDocument(org.openprovenance.prov.model.Document doc, String file) { Namespace.withThreadNamespace(doc.getNamespace()); System.out.println("saving document ... "); @SuppressWarnings("unused") Document doc2 = u.persist((org.openprovenance.prov.sql.Document) doc); dbKeys.put(file, ((org.openprovenance.prov.sql.Document) doc).getPk()); System.out.println("saved document " + ((org.openprovenance.prov.sql.Document) doc).getPk() + " for " + file); }
public void writeXMLDocument(Document doc, String file) throws JAXBException { ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser(); Namespace.withThreadNamespace(doc.getNamespace()); serial.serialiseDocument(new File(file), doc, true); StringWriter sw = new StringWriter(); serial.serialiseDocument(sw, doc, true); }
public void writeXMLDocument(Document doc, String file) throws JAXBException { ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser(); Namespace.withThreadNamespace(doc.getNamespace()); serial.serialiseDocument(new File(file), (org.openprovenance.prov.sql.Document)doc, true); StringWriter sw = new StringWriter(); serial.serialiseDocument(sw, (org.openprovenance.prov.sql.Document)doc, true); //System.out.println(sw.toString()); } @Override
public void writeDocument(Document doc, String file2) { Namespace.withThreadNamespace(doc.getNamespace()); try { writeXMLDocument(doc, file2); } catch (JAXBException e) { throw new UncheckedTestException(e); } }
public void writeDocument(Document doc, String file2) { Namespace.withThreadNamespace(doc.getNamespace()); try { writeXMLDocument(doc, file2); } catch (JAXBException e) { throw new UncheckedTestException(e); } }
@Override public void writeDocument(Document doc, String file) { Namespace.withThreadNamespace(doc.getNamespace()); String s = u.convertBeanToASN(doc,pFactory); u.writeTextToFile(s, file); }
@Override public void writeDocument(Document doc, String file) { Namespace.withThreadNamespace(doc.getNamespace()); String s = u.convertBeanToASN(doc,pFactory); u.writeTextToFile(s, file); }
public void writeDocument(Document doc, String file2) { Namespace.withThreadNamespace(doc.getNamespace()); try { writeXMLDocument(doc, file2); } catch (JAXBException e) { throw new UncheckedTestException(e); } }
@Override public void writeDocument(Document doc, String file) { Namespace.withThreadNamespace(doc.getNamespace()); String s = u.convertBeanToASN(doc,pFactory); u.writeTextToFile(s, file); }
public void writeDocument(Document doc, String file2) { Namespace.withThreadNamespace(doc.getNamespace()); try { writeXMLDocument(doc, file2); } catch (JAXBException e) { throw new UncheckedTestException(e); } }
@Override public void writeDocument(Document doc, String file) { Namespace.withThreadNamespace(doc.getNamespace()); String s = u.convertBeanToASN(doc,pFactory); u.writeTextToFile(s, file); }
public void testPC1SpecFull() throws JAXBException { Document graph = makePC1GraphAndSpecialization(pFactory); ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser(); Namespace.withThreadNamespace(graph.getNamespace()); serial.serialiseDocument(new File("target/pc1-spec.xml"), graph, true); graph1 = graph; //System.out.println("PC1Full Test asserting True"); assertTrue(true); }
public void subtestPC1Full() throws JAXBException { Document graph = makePC1FullGraph(pFactory); ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser(); Namespace.withThreadNamespace(graph.getNamespace()); serial.serialiseDocument(new File("target/pc1-full.xml"), graph, true); graph1 = graph; //System.out.println("PC1Full Test asserting True"); assertTrue(true); }
public Bundle doAction(Bundle b, ProvUtilities u) { List<Statement> sRecords = new LinkedList<Statement>(); QualifiedName bundleId=b.getId(); Namespace old=Namespace.getThreadNamespace(); Namespace bundleNamespace; if (b.getNamespace()!=null) { bundleNamespace=new Namespace(b.getNamespace()); } else { bundleNamespace=new Namespace(); } bundleNamespace.setParent(new Namespace(old)); //ensure to make a copy of old, since setting might otherwise create a loop Namespace.withThreadNamespace(bundleNamespace); c.startBundle(bundleId, b.getNamespace()); for (Statement s : u.getStatement(b)) { sRecords.add((Statement) u.doAction(s, this)); } return c.newNamedBundle(bundleId, b.getNamespace(), sRecords); }
public void fileToDot(String asnFile, String xmlFile, String dotFile, String pdfFile, String title) throws java.io.FileNotFoundException, java.io.IOException, JAXBException, Throwable { Utility u=new Utility(); ProvFactory pFactory=ProvFactory.getFactory(); Document o= (Document) u.convertASNToJavaBean(asnFile,pFactory); Namespace.withThreadNamespace(o.getNamespace()); System.out.println("ns is " + o.getNamespace()); ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser(); serial.serialiseDocument(new File(xmlFile),o,true); ProvToDot toDot=new ProvToDot("src/main/resources/defaultConfigWithRoleNoLabel.xml"); toDot.convert(o,dotFile,pdfFile,title); }
public void sculptureToDot(String asnFile, String xmlFile, String dotFile, String pdfFile, String title) throws java.io.FileNotFoundException, java.io.IOException, JAXBException, Throwable { Utility u=new Utility(); ProvFactory pFactory=ProvFactory.getFactory(); Document o= (Document) u.convertASNToJavaBean(asnFile,pFactory); Namespace.withThreadNamespace(o.getNamespace()); ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser(); serial.serialiseDocument(new File(xmlFile),o,true); ProvToDot toDot=new ProvToDot("src/main/resources/defaultConfigWithRoleNoLabel.xml"); toDot.convert(o,dotFile,pdfFile,title); }
public void testReadASNSaveXML(String file, String file2) throws java.io.IOException, java.lang.Throwable { Utility u=new Utility(); CommonTree tree = u.convertASNToTree(file); Object o2=u.convertTreeToJavaBean(tree,pFactory); graph1=(Document)o2; graph1.setNamespace(Namespace.gatherNamespaces(graph1)); try { ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser(); Namespace.withThreadNamespace(graph1.getNamespace()); serial.serialiseDocument(new File(file2),(Document)o2,true); assertTrue(true); } catch (JAXBException e) { e.printStackTrace(); } }