Package org.wymiwyg.rdf.graphs.impl

Examples of org.wymiwyg.rdf.graphs.impl.SimpleGraph


          try {
            Subject.doAsPrivileged(null, new PrivilegedExceptionAction() {
              public Object run() throws Exception {
                Source source = new SourceImpl("http://example.org/graph-source");
                try {
                  store.assertGraph(source, new FCAGraphImpl(new SimpleGraph()));
                } catch (AccessControlException ex) {
                  exceptionCatched[0] = true;
                }
                return null;
              }
View Full Code Here


        }
      } else {
        relevantTriples.add(triple);
      }
    }
    SimpleGraph result = new SimpleGraph();
    for (Triple triple : relevantTriples) {
      result.add(new TripleImpl(replaceIfPossible(triple.getSubject(),
          map), triple.getPredicate(), replaceIfPossible(triple
          .getObject(), map)));
    }
    result.markFinalized();
    return result;
  }
View Full Code Here

      return getNextSubGraph();
    }

    private Graph getNextSubGraph() {
      int count = 0;
      Graph currentGraph = new SimpleGraph();
      for (TripleInfo info : tripleInfos) {
        switch (info.status) {
        case undefined:
          if (count < omitUndefined) {
            count++;
            break;
          } else {
            currentGraph.add(info.triple);
          }
          ;
          break;
        case needed:
          currentGraph.add(info.triple);
        }
      }
      if (count == 0) {
        return null;
      }
      System.out.println("returning subgraph of size "
          + currentGraph.size());
      return currentGraph;
    }
View Full Code Here

                  }
                  Node object = triple.getObject();
                  if (!(object instanceof GroundedNode)) {
                    object = NonTerminalMolecule.GROUNDED_NODE;
                  }
                  SimpleGraph result = new SimpleGraph();
                  result.add(new TripleImpl(subject, triple
                      .getPredicate(), object));
                  result.markFinalized();
                  return result;
                }

              }.readComponent(componentDir);
            }
View Full Code Here

              .get(verificationParameters[0]);
          if (loginData == null) {
            throw new HandlerException(
                "Verification string not found, probably expired");
          }
          Graph graph = new SimpleGraph();
          addUser(loginData, graph, request);
          response
              .setDefaultStylesheet("/application/stylesheets/verification-result");
          response.setBody(graph);
          Resource user = getUserByUsernameInIdentityGOT(loginData.userName);
View Full Code Here

   */
  private static void updateWorkingGraph(Store store, Source identity, Date now, final Source aggregatedSource, final Graph logEntryGraph) {
    store.perform(identity, new StoreTransaction() {

      public void execute(SourceStoreView storeView) {
        SimpleGraph newWorkingGraph = new SimpleGraph();
        FCAGraph oldWorkingGraph = storeView.getGraph();
        Node downloadAttemptNode = null;
        for (Triple triple : oldWorkingGraph) {
          if (triple.getObject().equals(aggregatedSource) &&
              triple.getPredicate().getURIRef().equals(AGGREGATOR.aggregatedSource.getURI())) {
            downloadAttemptNode = triple.getSubject();
            break;
          }
        }
        for (Iterator<Triple> iter = oldWorkingGraph.iterator(); iter.hasNext();) {
          Triple triple = iter.next();
          //x.equals(null) should return false, making the first condition obsolete
          if ((downloadAttemptNode == null) || !triple.getSubject().equals(downloadAttemptNode)) {
            newWorkingGraph.add(triple);
          }
        }
        newWorkingGraph.addAll(logEntryGraph);
        newWorkingGraph.markFinalized();
        storeView.revokeAll();
        storeView.assertGraph(new FCAGraphImpl(newWorkingGraph));
      }
     
    });
View Full Code Here

  }

  public void testWithEmptyGraphs() throws Exception {
    FCAGraph[] graphs = new FCAGraph[4];
    for (int i = 0; i < graphs.length; i++) {
      SimpleGraph simpleGraph = new SimpleGraph();
      simpleGraph.markFinalized();
      graphs[i] = new FCAGraphImpl(simpleGraph);
    }
    performTestsWithGraphs(graphs);
  }
View Full Code Here

      }
      return getNextSubGraph();
    }
    private Graph getNextSubGraph() {
      int count  = 0;
      Graph currentGraph = new SimpleGraph();
      for (TripleInfo info : tripleInfos) {
        switch (info.status) {
        case undefined:
          if (count < omitUndefined) {
            count++;
            break;
          } else {
            currentGraph.add(info.triple);
          }
          ;
          break;
        case needed:
          currentGraph.add(info.triple);
        }
      }
      if (count == 0) {
        return null;
      }
      System.out.println("returning subgraph of size "+currentGraph.size());
      return currentGraph;
    }
View Full Code Here

*
*/
public class ReferenceGroundedUtil {

  public static Graph reconstructGraph(ReferenceGroundedDecomposition dec) {
    Graph graph = new SimpleGraph();
    for (TerminalMolecule terminalMolecule : dec.getTerminalMolecules()) {
      graph.addAll(terminalMolecule);
    }
    for (ContextualMolecule contextualMolecule : dec.getContextualMolecules()) {
      graph.addAll(contextualMolecule);
    }
    return new NaturalizedGraph(graph, dec.getFunctionallyGroundedNodes());
  }
View Full Code Here

   *
   * @param graph
   * @param naturalizer
   */
  public NaturalizedGraph(Graph graph, Naturalizer naturalizer) {
    Graph fgNodesGraph = new SimpleGraph();
    Map<Set<NonTerminalMolecule>, Node> replacementMap = new HashMap<Set<NonTerminalMolecule>, Node>();
    addGraphTriples(graph, true, naturalizer, replacementMap, fgNodesGraph);
   
    while (fgNodesGraph.size() > 0) {
      //add the triples of the fg-nodes graph and repeat if new triples result from fg-nodes replacemnets
      //withing these triples
      Graph addingFgNodesGraph = fgNodesGraph;
      fgNodesGraph = new SimpleGraph();
      addGraphTriplesaddingFgNodesGraph, true, naturalizer, replacementMap, fgNodesGraph);
    }
    markFinalized();
  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.graphs.impl.SimpleGraph

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.