Package org.wymiwyg.rdf.graphs

Examples of org.wymiwyg.rdf.graphs.Node


  private void writeGraph(File directory, Graph graph) throws IOException {
    NaturalizedGraph naturalizedGraph = new NaturalizedGraph(graph,
        new Naturalizer() {
          public Node naturalize(FunctionallyGroundedNode fgNode,
              Graph graph) {
            Node anonymousNode = new NodeImpl();
            graph.add(new TripleImpl(anonymousNode,
                new PropertyNodeImpl(
                    MODELDIFF.functionallyGroundedIn
                        .getURI()),
                addFunctionallyGroundedNode(fgNode)));
View Full Code Here


    Map<Node, FunctionallyGroundedNode> map = new HashMap<Node, FunctionallyGroundedNode>();
    Set<Triple> relevantTriples = new HashSet<Triple>();
    for (Triple triple : graph) {
      if (triple.getPredicate().getURIRef().equals(
          MODELDIFF.functionallyGroundedIn.getURI())) {
        Node subject = triple.getSubject();
        if (!map.containsKey(subject)) {
          map.put(subject,
              getFunctionallyGroundedNode((NamedNode) triple
                  .getObject()));
        }
View Full Code Here

   * @param map
   * @return
   */
  private Node replaceIfPossible(Node subject,
      Map<Node, FunctionallyGroundedNode> map) {
    Node result = map.get(subject);
    if (result == null) {
      result = subject;
    }
    return result;
  }
View Full Code Here

                    throw new RuntimeException(
                        "nt-molecules should be of size 1");
                  }
                  Triple triple = deNaturalized.iterator()
                      .next();
                  Node subject = triple.getSubject();
                  if (!(subject instanceof GroundedNode)) {
                    subject = NonTerminalMolecule.GROUNDED_NODE;
                  }
                  Node object = triple.getObject();
                  if (!(object instanceof GroundedNode)) {
                    object = NonTerminalMolecule.GROUNDED_NODE;
                  }
                  SimpleGraph result = new SimpleGraph();
                  result.add(new TripleImpl(subject, triple
View Full Code Here

   * @throws HandlerException
   */
  private void addUser(LoginData loginData, Graph graph, Request request)
      throws HandlerException {
    // TODO use an jenaModelWrapper (TBD)
    Node user = new NodeImpl();
    graph.add(new TripleImpl(user, new PropertyNodeImpl(RDF.type.getURI()),
        new NamedNodeImpl(FOAF.Agent.getURI())));
    graph.add(new TripleImpl(user, new InverseFunctionalPropertyNodeImpl(
        ACCOUNTMANAGER.userName.getURI()), new PlainLiteralNodeImpl(
        loginData.userName)));
View Full Code Here

    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;
View Full Code Here

      lastResourcesCount = resources.size();
      graph = completeGraph.filter(resources);
      for (Triple triple : graph) {
        if (triple.getPredicate().equals(
            new PropertyNodeImpl(DISCOBITS.getURI() + "holds"))) {
          Node object = triple.getObject();
          if (object instanceof GroundedNode) {
            resources.add((GroundedNode) object);
          }
        }
      }
View Full Code Here

    }
  }

  private FunctionallyGroundedNode functionalyze(NamedNode node) {
    FunctionallyGroundedNodeImpl result = new FunctionallyGroundedNodeImpl();
    Node afgn = new NodeImpl();
    SimpleNonTerminalMolecule molecule = new SimpleNonTerminalMolecule(afgn);
    String uriString = node.getURIRef();
    LiteralNode uriLit = new TypedLiteralNodeImpl(uriString, anyURIDataType);
    Triple triple = new TripleImpl(afgn, nameProp, uriLit);
    molecule.add(triple);
View Full Code Here

  }

  private NonTerminalMolecule functionalyze(NonTerminalMolecule molecule) {
    SimpleNonTerminalMolecule result = new SimpleNonTerminalMolecule(NonTerminalMolecule.GROUNDED_NODE);
    Triple origTriple = molecule.iterator().next();
    Node subject = origTriple.getSubject();
    if (subject instanceof GroundedNode) {
      subject = functionalyze((GroundedNode)subject);
    }
    Node object = origTriple.getObject();
    if (object instanceof GroundedNode) {
      object = functionalyze((GroundedNode)object);
    }
    Triple newTriple = new TripleImpl(subject, origTriple.getPredicate(), object);
    result.add(newTriple);
View Full Code Here

   * @return
   */
  private static Triple processTriple(Node afgn, Triple originalTriple,
      Map<Node, FunctionallyGroundedNodeImpl> nodeReplacementMap) {
    Triple triple;
    Node subject = originalTriple.getSubject();
    Node object = originalTriple.getObject();
    if (subject.equals(afgn)) {
      subject = GROUNDED_NODE;
    } else {
      if (nodeReplacementMap.containsKey(subject)) {
        subject = nodeReplacementMap.get(subject);
      }
    }
    if (object.equals(afgn)) {
      object = GROUNDED_NODE;
    } else {
      if (nodeReplacementMap.containsKey(object)) {
        object = nodeReplacementMap.get(object);
      }
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.graphs.Node

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.