Package org.wymiwyg.rdf.molecules.functref

Examples of org.wymiwyg.rdf.molecules.functref.ReferenceGroundedDecomposition


        .unmodifiableSet(contextualMolecules);
    final Set<TerminalMolecule> unmodifiableTerminalMolecules = Collections
        .unmodifiableSet(terminalMolecules);
   

    ReferenceGroundedDecomposition result = new ReferenceGroundedDecomposition() {

      public Set<MaximumContextualMolecule> getContextualMolecules() {
        return unmodifiableContextualMolecules;
      }
View Full Code Here


    for (int i = 0; i < 5; i++) {
      Model model = ModelFactory.createDefaultModel();
      model
          .read(getClass().getResource("unlean-ifp-turn.rdf")
              .toString());
      ReferenceGroundedDecomposition dec1 = getDecomposition(model);
      assertEquals("no contextual molecules",
          new HashSet<MaximumContextualMolecule>(), dec1
              .getContextualMolecules());
    }
  }
View Full Code Here

        + " _:2 http://xmlns.com/foaf/0.1/homepage _:1;"
        + " _:1 http://xmlns.com/foaf/0.1/mbox_sha1sum 'urn:urn-5:WNjqsnamsLlMJNMLDxjg-nLG0A8=''");
    Model model1 = modelWithStatements(" _:1 http://xmlns.com/foaf/0.1/mbox_sha1sum 'urn:urn-5:WNjqsnamsLlMJNMLDxjg-nLG0A8='';"
        + "_:1 http://xmlns.com/foaf/0.1/mbox _:1;"
        + " _:2 http://xmlns.com/foaf/0.1/homepage _:1;");
    ReferenceGroundedDecomposition dec = getDecomposition(model);
    Set<FunctionallyGroundedNode> fgNodes = dec
        .getFunctionallyGroundedNodes();
    ReferenceGroundedDecomposition dec1 = getDecomposition(model1);
    Set<FunctionallyGroundedNode> fgNodes1 = dec1
        .getFunctionallyGroundedNodes();
    FunctionallyGroundedNode fgNode = fgNodes.iterator().next();
    FunctionallyGroundedNode fgNode1 = fgNodes1.iterator().next();
    System.out.println("Hash: " + fgNode.hashCode());
    System.out.println("Hash1: " + fgNode1.hashCode());
    System.out.println("Equals: " + fgNode.equals(fgNode1));
    assertEquals("fgnodes", 2, dec1.getFunctionallyGroundedNodes().size());
    assertEquals("Hashsed", fgNode.hashCode(), fgNode1.hashCode());
  }
View Full Code Here

        + " _:1 http://xmlns.com/foaf/0.1/mbox _:4;"
        + " _:2 http://xmlns.com/foaf/0.1/homepage _:3;"
        + " _:3 http://xmlns.com/foaf/0.1/mbox_sha1sum 'foo';"
        + " _:4 http://xmlns.com/foaf/0.1/homepage _:5;"
        + " _:5 http://xmlns.com/foaf/0.1/mbox_sha1sum 'bar'");
    ReferenceGroundedDecomposition dec = getDecomposition(model);
    Set<FunctionallyGroundedNode> fgNodes = dec
        .getFunctionallyGroundedNodes();
    ReferenceGroundedDecomposition dec1 = getDecomposition(model1);
    Set<FunctionallyGroundedNode> fgNodes1 = dec1
        .getFunctionallyGroundedNodes();
    FunctionallyGroundedNode fgNode = selectFGNodeWithProperty(fgNodes,
        new FunctionalPropertyNodeImpl(FOAF.mbox.getURI()));
    FunctionallyGroundedNode fgNode1 = selectFGNodeWithProperty(fgNodes1,
        new FunctionalPropertyNodeImpl(FOAF.mbox.getURI()));
View Full Code Here

        + " _:1 http://xmlns.com/foaf/0.1/mbox_sha1sum 'urn:urn-5:WNjqsnamsLlMJNMLDxjg-nLG0A8=''");
    Model model1 = modelWithStatements(" _:2 http://xmlns.com/foaf/0.1/mbox_sha1sum 'urn:urn-5:WNjqsnamsLlMJNMLDxjg-nLG0A8='';"
        + "_:2 http://xmlns.com/foaf/0.1/mbox _:1;"
        + " _:1 http://xmlns.com/foaf/0.1/homepage _:2;");
    assertTrue(model1.isIsomorphicWith(model));
    ReferenceGroundedDecomposition dec = getDecomposition(model);
    Set<FunctionallyGroundedNode> fgNodes = dec
        .getFunctionallyGroundedNodes();
    ReferenceGroundedDecomposition dec1 = getDecomposition(model1);
    Set<FunctionallyGroundedNode> fgNodes1 = dec1
        .getFunctionallyGroundedNodes();
    System.out.println("Nodes in fgNodes");
    for (FunctionallyGroundedNode fgNode : fgNodes) {
      System.out.println("Hash: " + fgNode.hashCode());
      System.out.println("Node: " + fgNode);
      System.out.println();
    }
    System.out.println("Nodes in fgNodes1");
    for (FunctionallyGroundedNode fgNode : fgNodes1) {
      System.out.println("Hash: " + fgNode.hashCode());
      System.out.println("Node: " + fgNode);
      System.out.println();
    }

    System.out.println("Set Equals: " + fgNodes.equals(fgNodes1));
    assertEquals("fgnodes", 2, dec1.getFunctionallyGroundedNodes().size());
    assertEquals("Hashcodes", fgNodes.hashCode(), fgNodes1.hashCode());
  }
View Full Code Here

    model.read(getClass().getResourceAsStream("molecule1.rdf"), "");
    // add second
    model.read(getClass().getResourceAsStream("molecule2.rdf"), "");
    // add thrid
    model.createResource(FOAF.Person);
    ReferenceGroundedDecomposition refDec = getDecomposition(model, false);
    Collection<Molecule> moleculeSet = new HashSet<Molecule>(refDec
        .getContextualMolecules());
    moleculeSet.addAll(refDec.getTerminalMolecules());
    System.out.println("Total molecules: " + moleculeSet.size());
    for (Iterator iter = moleculeSet.iterator(); iter.hasNext();) {
      Molecule current = (Molecule) iter.next();
      System.out.println(current.getClass() + ": " + current);
    }
View Full Code Here

    model.read(getClass().getResourceAsStream(resourceName), "");
    return getSingleMolecule(model);
  }

  protected Molecule getSingleMolecule(Model model) {
    ReferenceGroundedDecomposition refDec = getDecomposition(model, false);
    Collection<Molecule> moleculeSet = new HashSet<Molecule>(refDec
        .getContextualMolecules());
    moleculeSet.addAll(refDec.getTerminalMolecules());
    assertEquals("Single molecule model contains one molecule", 1,
        moleculeSet.size());
    return (Molecule) moleculeSet.iterator().next();
  }
View Full Code Here

   * one of the mbox statements occasionally goes missing
   */
  public void test15() {
    for (int i = 0; i < 20; i++) {
      Model model = getModelFromResource("test15.rdf");
      ReferenceGroundedDecomposition refDec = getDecomposition(model);
      IntSet sizes = new IntOpenHashSet();
      for (FunctionallyGroundedNode fgNode : refDec
          .getFunctionallyGroundedNodes()) {
        sizes.add(fgNode.getGroundingMolecules().size());
      }
      System.out.println(sizes);
      IntSet expectedSizes = new IntOpenHashSet();
View Full Code Here

    Model model = ModelFactory.createDefaultModel();
    model.read(
        getClass().getResource("contextual-molecules.n3").toString(),
        "N3");

    ReferenceGroundedDecomposition ref = getDecomposition(model);
    assertEquals("counting contextula molecules", 2, ref
        .getContextualMolecules().size());

  }
View Full Code Here

      System.out.println("round "+i);
      Model model = ModelFactory.createDefaultModel();
      model.read(getClass().getResource("single-contextual.rdf")
          .toString());

      ReferenceGroundedDecomposition ref = getDecomposition(model);
      assertEquals("counting contextula molecules", 1, ref
          .getContextualMolecules().size());
    }

  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.molecules.functref.ReferenceGroundedDecomposition

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.