Package org.wymiwyg.rdf.molecules.diff

Examples of org.wymiwyg.rdf.molecules.diff.MoleculeDiff


     * .getResource("../test/person-plus-1-ifp.n3").toString(), "N3");
     */

    m2.read(RDFZipSerializer.class.getResource("../test/test2.rdf")
        .toString(), "RDF/XML");
    MoleculeDiff diff = new MoleculeDiffImpl(m1, m2, true);
    System.out.println(diff);

    OutputStream out = new FileOutputStream("/home/reto/test.zip");
    new RDFZipSerializer().serialize(diff, out);
    out.close();
    MoleculeDiff reDeserialised = new MoleculeDiffDeserialized(new File(
        "/home/reto/test.zip"));

    System.out.println();
    System.out.println(reDeserialised);

    Model m2reconstructed = JenaUtil
        .getModelFromGraph(ReferenceGroundedUtil
            .reconstructGraph(reDeserialised
                .patch(new ReferenceGroundedDecompositionImpl(
                    JenaUtil.getGraphFromModel(m1, true)))));
    System.out.println(m2reconstructed.isIsomorphicWith(m2));
    System.out.println("m1");
    m1.write(System.out);
View Full Code Here


      m2 = LeanDiffPatch.leanify(m2);
      m1.write(new FileOutputStream(File.createTempFile("random-model-1",
          ".nt")), "N-TRIPLE");
      m2.write(new FileOutputStream(File.createTempFile("random-model-1",
          ".nt")), "N-TRIPLE");
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);
      File zipFile = File.createTempFile("random-model", ".zip");
      OutputStream diffOut = new FileOutputStream(zipFile);
      diff.serialize(diffOut);
      diffOut.close();
      MoleculeDiff diffRec;// = LeanDiffPatch.deserializeDiff(zipFile);
      {
        InputStream in1 = new FileInputStream(zipFile);
        File tempFile = File.createTempFile(Util.createRandomString(5),
            "dzip");
        FileOutputStream tempOut = new FileOutputStream(tempFile);
View Full Code Here

          .read(getClass().getResource("test2-1.nt").toString(),
              "N-TRIPLE");
      m2
          .read(getClass().getResource("test2-2.nt").toString(),
              "N-TRIPLE");
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      File file = File.createTempFile("test2-serial", ".zip");
      OutputStream diffOut = new FileOutputStream(file);
      diff.serialize(baos);
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        throw new RuntimeException(e);
      }
      baos.close();
      diffOut.write(baos.toByteArray());
      diffOut.close();

      MoleculeDiff diffRec;
      {
        // with my jvm (Java(TM) 2 Runtime Environment, Standard Edition
        // (build 1.5.0_05-b05)) it
        // regularly fails when reading file directly!!!
        InputStream in1 = new FileInputStream(file);
View Full Code Here

    Model m2 = ModelFactory.createDefaultModel();
    m1.read(getClass().getResource("test4-1.nt").toString(), "N-TRIPLE");
    m2.read(getClass().getResource("test4-2.nt").toString(), "N-TRIPLE");
    m1 = LeanDiffPatch.leanify(m1);
    m2 = LeanDiffPatch.leanify(m2);
    MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);
    System.out.println(diff);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    File file = File.createTempFile("test4-serial", ".zip");
    OutputStream diffOut = new FileOutputStream(file);
    diff.serialize(baos);
    try {
      Thread.sleep(100);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    baos.close();
    diffOut.write(baos.toByteArray());
    diffOut.close();

    MoleculeDiff diffRec;

    {
      // with my jvm (Java(TM) 2 Runtime Environment, Standard Edition
      // (build 1.5.0_05-b05)) it
      // regularly fails when reading file directly!!!
View Full Code Here

  public void test1() throws IOException {
    Model m1 = ModelFactory.createDefaultModel();
    Model m2 = ModelFactory.createDefaultModel();
    m1.read(getClass().getResource("test1-1.nt").toString(), "N-TRIPLE");
    m2.read(getClass().getResource("test1-2.nt").toString(), "N-TRIPLE");
    MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);
    File file = File.createTempFile("test1-serial", ".zip");
    diff.serialize(new FileOutputStream(file));
    System.out.println(diff);
    MoleculeDiff diffRec = LeanDiffPatch.deserializeDiff(file);
    System.out.println(diffRec);
    Model m2reconstructed = LeanDiffPatch.patch(m1, diffRec);
    m2reconstructed.write(System.out);
    assertTrue("reconstructed is isomorphic", m2
        .isIsomorphicWith(m2reconstructed));
View Full Code Here

      m2
          .read(getClass().getResource("test6-2.nt").toString(),
              "N-TRIPLE");
      m1 = LeanDiffPatch.leanify(m1);
      m2 = LeanDiffPatch.leanify(m2);
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);

      //System.out.println(diff);
      File file = File.createTempFile("test6-serial", ".zip");
      diff.serialize(new FileOutputStream(file));
      MoleculeDiff diffRec = LeanDiffPatch.deserializeDiff(file);
      Model m2reconstructed = LeanDiffPatch.patch(m1, diffRec);
      m2reconstructed = LeanDiffPatch.leanify(m2reconstructed);
      //m2.write(System.out);
      //m2reconstructed.write(System.out);
      //System.out.println(LeanDiffPatch.getDiff(m2, m2reconstructed));
View Full Code Here

      m2
          .read(getClass().getResource("test7-2.nt").toString(),
              "N-TRIPLE");
      m1 = LeanDiffPatch.leanify(m1);
      m2 = LeanDiffPatch.leanify(m2);
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);

      System.out.println(diff);
      File file = File.createTempFile("test7-serial", ".zip");
      diff.serialize(new FileOutputStream(file));
      MoleculeDiff diffRec = diff;// LeanDiffPatch.deserializeDiff(file);
      System.out.println(diff.getCommonFgNodesInDiffMolecules().size());
      System.out
          .println(diffRec.getCommonFgNodesInDiffMolecules().size());
      Model m2reconstructed = LeanDiffPatch.patch(m1, diff);// diffRec);
      // m2reconstructed.write(System.out);
      System.out.println(LeanDiffPatch.getDiff(m2, m2reconstructed));
      assertTrue("reconstructed is isomorphic", m2
          .isIsomorphicWith(m2reconstructed));
View Full Code Here

      m2
          .read(getClass().getResource("test8-2.nt").toString(),
              "N-TRIPLE");
      m1 = LeanDiffPatch.leanify(m1);
      m2 = LeanDiffPatch.leanify(m2);
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);

      System.out.println(diff);
      File file = File.createTempFile("test8-serial", ".zip");
      diff.serialize(new FileOutputStream(file));
      MoleculeDiff diffRec = diff;// LeanDiffPatch.deserializeDiff(new
      // File("test7-serial.zip"));
      System.out.println(diff.getCommonFgNodesInDiffMolecules().size());
      System.out
          .println(diffRec.getCommonFgNodesInDiffMolecules().size());
      Model m2reconstructed = LeanDiffPatch.patch(m1, diff);// diffRec);
      // m2reconstructed.write(System.out);
      System.out.println(LeanDiffPatch.getDiff(m2, m2reconstructed));
      assertTrue("reconstructed is isomorphic", m2
          .isIsomorphicWith(m2reconstructed));
View Full Code Here

  public void test9() throws IOException {
    Model m1 = ModelFactory.createDefaultModel();
    Model m2 = ModelFactory.createDefaultModel();
    m1.read(getClass().getResource("test9.nt").toString(), "N-TRIPLE");
    m1 = LeanDiffPatch.leanify(m1);
    MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);

    System.out.println(diff);
    File file = File.createTempFile("test9-serial", ".zip");
    diff.serialize(new FileOutputStream(file));
    MoleculeDiff diffRec = diff;// LeanDiffPatch.deserializeDiff(new
    // File("test7-serial.zip"));
    System.out.println(diff.getCommonFgNodesInDiffMolecules().size());
    System.out.println(diffRec.getCommonFgNodesInDiffMolecules().size());
    Model m2reconstructed = LeanDiffPatch.patch(m1, diff);// diffRec);
    // m2reconstructed.write(System.out);
    System.out.println(LeanDiffPatch.getDiff(m2, m2reconstructed));
    assertTrue("reconstructed is isomorphic", m2
        .isIsomorphicWith(m2reconstructed));
View Full Code Here

          "N-TRIPLE");
      m2.read(getClass().getResource("test10-2.nt").toString(),
          "N-TRIPLE");
      m1 = LeanDiffPatch.leanify(m1);
      m2 = LeanDiffPatch.leanify(m2);
      MoleculeDiff diff = LeanDiffPatch.getDiff(m1, m2);

      System.out.println(diff);
      File file = File.createTempFile("test10-serial", ".zip");
      diff.serialize(file);
      MoleculeDiff diffRec = diff;// LeanDiffPatch.deserializeDiff(file);
      System.out.println(diff.getCommonFgNodesInDiffMolecules().size());
      System.out
          .println(diffRec.getCommonFgNodesInDiffMolecules().size());
      Model m2reconstructed = LeanDiffPatch.patch(m1, diff);// diffRec);
      // m2reconstructed.write(System.out);
      System.out.println(LeanDiffPatch.getDiff(m2, m2reconstructed));
      assertTrue("reconstructed is isomorphic", m2
          .isIsomorphicWith(m2reconstructed));
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.molecules.diff.MoleculeDiff

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.