Package org.wymiwyg.rdf.molecules.functref

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


  private void addData(MoleculeStore moleculeStore, String modelName) {
    Model model = ModelFactory.createDefaultModel();
    model.read(StoreTest.class.getResource(modelName).toString());
    Graph graph = JenaUtil.getGraphFromModel(model , true);
    ModelReferencingDecomposition modelReferencingDecomposition = new ModelReferencingDecompositionImpl(graph);
    ReferenceGroundedDecomposition dec = new ReferenceGroundedDecompositionImpl(modelReferencingDecomposition);
    for (FunctionallyGroundedNode fgNode : dec.getFunctionallyGroundedNodes()) {
      moleculeStore.addFunctionallyGroundedNode(fgNode);
    }
    for (TerminalMolecule terminalMolecule : dec.getTerminalMolecules()) {
      moleculeStore.addTerminalMolecule(terminalMolecule);
    }
    for (MaximumContextualMolecule molecule : dec.getContextualMolecules()) {
      moleculeStore.addContextualMolecule(molecule);
    }
   
  }
View Full Code Here


  }

  public synchronized void assertGraph(Source source, FCAGraph graph) {
    AccessController.checkPermission(new GVSImpersonatePermission(source));
    ReferenceGroundedDecomposition dec = graph;
    Date moment = clock.getTime();
    addFGNodes(source, dec.getFunctionallyGroundedNodes(), moment);
    addTMolecules(source, dec.getTerminalMolecules(), moment);
    addCMolecules(source, dec.getContextualMolecules(), moment);
  }
View Full Code Here

          return getDateList(sources, d, true);
        }
      }

      public FCAGraph getGraph(Date moment) {
        ReferenceGroundedDecomposition dec = getDecomposition(sources,
            moment);
        return new FCAGraphImpl(dec);
      }

      public Iterator<Date> previousChanges(Date d) {
View Full Code Here

  public synchronized void revokeGraph(Source source, FCAGraph graph) {
    // not that easy: find existing assertions
    // processGraph(source, graph, moment, METAMODEL.revocationTime);
    AccessController.checkPermission(new GVSImpersonatePermission(source));
    ReferenceGroundedDecomposition dec = graph;
    // TODO smart revoking of the nt-molecules of the fg-nodes that are not
    // used in other statements
    Date moment = clock.getTime();
    // revokeFGNodes(source, dec.getFunctionallyGroundedNodes(), moment);
    revokeTMolecules(source, dec.getTerminalMolecules(), moment);
    revokeCMolecules(source, dec.getContextualMolecules(), moment);

  }
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();
    Model model = modelWithStatements("http://example.org/a dc:title 'Hello';" +
        "_:a http://xmlns.com/foaf/0.1/mbox http://example.org/b;" +
        "_:a rdfs:comment _:b");
    ReferenceGroundedDecomposition baseDec = new ReferenceGroundedDecompositionImpl(
        new ModelReferencingDecompositionImpl(JenaUtil.getGraphFromModel(model, true)));
    simpleFilterableDecomposition = new SimpleFilterableDecomposition(baseDec);
  }
View Full Code Here

          new ReferenceGroundedDecompositionImpl(
              g2));
      File file = File.createTempFile("minimum-failing",".zip");
      diff.serialize(new FileOutputStream(file));
      MoleculeDiff diffRec =  LeanDiffPatch.deserializeDiff(file);
      ReferenceGroundedDecomposition dec2rec = diffRec
          .patch(new ReferenceGroundedDecompositionImpl(
              (g1)));
      Graph g2rec = ReferenceGroundedUtil.reconstructGraph(dec2rec);
      //TODO find out why test 20 fails without this line
      g2rec = JenaUtil.getGraphFromModel(JenaUtil.getModelFromGraph(g2rec), true);
View Full Code Here

public class MoleculesDiffTest extends TestCase {

  public void testFgNodes() {
    Model model1 = createFgNodeTestModel1(); // ModelFactory.createDefaultModel();
    Model model2 = createFgNodeTestModel2();
    ReferenceGroundedDecomposition dec1 = new ReferenceGroundedDecompositionImpl(
        JenaUtil.getGraphFromModel(model1, true));
    ReferenceGroundedDecomposition dec2 = new ReferenceGroundedDecompositionImpl(
        JenaUtil.getGraphFromModel(model2, true));
    MoleculeDiff diff = new MoleculeDiffImpl(dec1, dec2);
    diff.print(new PrintWriter(System.out, true));
    assertEquals("cross-graph nodset", 1, diff.getCrossGraphFgNodes()
        .size());
View Full Code Here

  }

  public void testFgNodesAllwayReplaces() {
    Model model1 = createFgNodeTestModel1(); // ModelFactory.createDefaultModel();
    Model model2 = createFgNodeTestModel2();
    ReferenceGroundedDecomposition dec1 = new ReferenceGroundedDecompositionImpl(
        JenaUtil
            .getGraphFromModel(model1, true));
    ReferenceGroundedDecomposition dec2 = new ReferenceGroundedDecompositionImpl(
        JenaUtil
            .getGraphFromModel(model2, true));
    MoleculeDiff diff = new MoleculeDiffImpl(dec1, dec2, true);
    diff.print(new PrintWriter(System.out, true));
    assertEquals("cross-graph nodset", 1, diff.getCrossGraphFgNodes()
View Full Code Here

      }
      previousResource.addProperty(FOAF.mbox, model
          .createResource("mailto:foo"));
    }
    Graph graph = JenaUtil.getGraphFromModel(model, true);
    ReferenceGroundedDecomposition dec = new ReferenceGroundedDecompositionImpl(
        new AnonymizedGraph(graph));
    /*System.out.println(dec.getContextualMolecules().size() + " - "
        + dec.getFunctionallyGroundedNodes().size() + " - "
        + dec.getTerminalMolecules().size());*/
    Set<FunctionallyGroundedNode> functionallyGroundedNodes = dec
        .getFunctionallyGroundedNodes();
    //System.out.println(functionallyGroundedNodes);
    Map<?, FunctionallyGroundedNode> nodeMap1 = FgNodeMergerTest.map(functionallyGroundedNodes);
    long startDate = System.currentTimeMillis();
    Map<?, FunctionallyGroundedNode> nodeMap1Merged = FgNodeMerger
View Full Code Here

      StringWriter stringWriter = new StringWriter();
      JenaUtil.getModelFromGraph(graph).write(stringWriter);
      log.debug("Anonymized graph: ");
      log.debug(stringWriter);
    }
    ReferenceGroundedDecomposition refDec = new ReferenceGroundedDecompositionImpl(graph);
    ReferenceGroundedDecomposition leanifiedDec = getLeanVersionWithoutAnonymizing(refDec);
    Graph nonNaturalGraph = new SimpleGraph();
    for (Iterator<MaximumContextualMolecule> iter = leanifiedDec
        .getContextualMolecules().iterator(); iter.hasNext();) {
      nonNaturalGraph.addAll(iter.next());
    }
    for (Iterator<TerminalMolecule> iter = leanifiedDec.getTerminalMolecules()
        .iterator(); iter.hasNext();) {
      nonNaturalGraph.addAll(iter.next());
    }

    try {
      SimpleGraph result = new NaturalizedGraph(nonNaturalGraph, leanifiedDec
          .getFunctionallyGroundedNodes());
      result.markFinalized();
      /*System.out.println("DEBUG not anonymized:");
      JenaUtil.getModelFromGraph(result).write(System.out, "N3");*/
      return result;
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.