public void testRDFReadAnnotation() throws Exception {
    OPMRdf2Xml fromRdf = new OPMRdf2Xml();
    System.out.println("testRDFReadAnnotation (AnnotationReadTest.java)");
    graph2 = fromRdf.convert("target/annotation1-rdf.xml");

    OPMSerialiser serial = OPMSerialiser.getThreadOPMSerialiser();
    serial.serialiseOPMGraph(new File("target/annotation-example1-from-rdf.xml"), graph2, true);

    System.out.println("testRDFReadAnnotation (AnnotationReadTest.java): asserting True");
    assertTrue(true);

    // dont call todot, since exands annotations
    // OPMToDot toDot=new OPMToDot();
    // toDot.convert(graph2,"target/annotation1-rdf.dot", "target/annotation1-rdf.pdf");

    OPMDeserialiser deserial = OPMDeserialiser.getThreadOPMDeserialiser();
    OPMGraph graph = deserial.deserialiseOPMGraph(new File("target/annotation-example1.xml"));

    assertTrue(graph != null);

    Normalise normaliser = new Normalise(oFactory);

    normaliser.updateOriginalGraph(graph);
    normaliser.updateFromRdfGraph(graph2);

    normaliser.sortGraph(graph);
    normaliser.sortGraph(graph2);

    serial.serialiseOPMGraph(
        new File("target/annotation-example1-from-rdf-updated.xml"), graph2, true);

    serial.serialiseOPMGraph(new File("target/annotation-example1-updated.xml"), graph, true);

    assertTrue("self graph differ", graph.equals(graph));

    assertTrue("self graph2  differ", graph2.equals(graph2));

    assertTrue(
        "accounts differ",
        graph.getAccounts().getAccount().equals(graph2.getAccounts().getAccount()));

    assertTrue(
        "account overalps differ",
        graph.getAccounts().getOverlaps().equals(graph2.getAccounts().getOverlaps()));

    assertTrue("accounts elements differ", graph.getAccounts().equals(graph2.getAccounts()));

    assertTrue("processes elements differ", graph.getProcesses().equals(graph2.getProcesses()));

    assertTrue("artifacts elements differ", graph.getArtifacts().equals(graph2.getArtifacts()));

    assertTrue("edges elements differ", graph.getDependencies().equals(graph2.getDependencies()));

    if (graph.getAgents() != null && graph2.getAgents() != null) {
      assertTrue("agents elements differ", graph.getAgents().equals(graph2.getAgents()));
    } else {
      if (graph.getAgents() != null) {
        assertTrue(
            "agents elements differ, graph not null", graph.getAgents().getAgent().isEmpty());
        graph.setAgents(null);
      } else if (graph2.getAgents() != null) {
        assertTrue(
            "agents elements differ, graph not null", graph2.getAgents().getAgent().isEmpty());
        graph2.setAgents(null);
      }
    }

    assertTrue("graph differ", graph.equals(graph2));
  }
예제 #2
0
 public void setId(String value) {
   super.setId(value);
   qname = new QName(prefix, value);
   manager.designate(qname, org.openprovenance.rdf.OPMGraph.class);
 }