Esempio n. 1
0
  public void testReadXMLGraph()
      throws javax.xml.bind.JAXBException, org.xml.sax.SAXException, java.io.IOException {

    ProvDeserialiser deserial = ProvDeserialiser.getThreadProvDeserialiser();
    Document c = deserial.deserialiseDocument(new File("../prov-xml/target/pc1-full.xml"));
    Utility u = new Utility();

    String[] schemaFiles = new String[1];
    schemaFiles[0] = "../prov-xml/src/test/resources/pc1.xsd";

    // TODO: now failing because of QName
    // deserial.validateDocument(schemaFiles,new File("../prov-xml/target/pc1-full.xml"));

    // String s=u.convertBeanToASN(c);
    // System.out.println(s);

    ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser();

    c.setNamespace(Namespace.gatherNamespaces(c));

    Document c2 = (Document) u.convertJavaBeanToJavaBean(c, pFactory);
    c2.setNamespace(c.getNamespace());

    Namespace.withThreadNamespace(c2.getNamespace());
    serial.serialiseDocument(new File("target/pc1-full-2.xml"), c2, true);
  }
 public Document makeDocument() {
   Document graph = pFactory.newDocument();
   List<StatementOrBundle> ll = graph.getStatementOrBundle();
   Collection<Collection<StatementOrBundle>> acc = new LinkedList<Collection<StatementOrBundle>>();
   overallWorkflow(acc);
   for (Collection<StatementOrBundle> col : acc) ll.addAll(col);
   graph.setNamespace(Namespace.gatherNamespaces(graph));
   return graph;
 }