Package org.apache.clerezza.rdf.utils

Examples of org.apache.clerezza.rdf.utils.GraphNode


    }
  }

  private Graph getLanguageContext(NonLiteral langUri) {
    Graph lingvojRdf = getLingvojGraph();
    GraphNode languageNode = new GraphNode(langUri, lingvojRdf);
    return languageNode.getNodeContext();
  }
View Full Code Here


  @GET
  @Path("new")
  public GraphNode emptyPrefixBinding() {
    MGraph resultMGraph = new SimpleMGraph();
    GraphNode result = new GraphNode(new BNode(), resultMGraph);
    result.addProperty(RDF.type, CURIE.CuriePrefixBinding);
    result.addProperty(CURIE.prefix,
        literalFactory.createTypedLiteral("foaf"));
    result.addProperty(CURIE.binding,
        literalFactory.createTypedLiteral("http://xmlns.com/foaf/0.1/"));
    result.addProperty(RDF.type, PLATFORM.HeadedPage);
    return result;
  }
View Full Code Here

    try {
      NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
      if (binding == null) {
        binding = new BNode();
      }
      GraphNode bindingNode;
      if (oldBindingValue != null) {
        NonLiteral oldBinding = getBindingWithValue(oldBindingValue, contentGraph);
        if (oldBinding != null) {
          GraphNode oldBindingNode = new GraphNode(oldBinding, contentGraph);
          oldBindingNode.replaceWith(binding);
        }
      }
      bindingNode = new GraphNode(binding, contentGraph);
      bindingNode.addProperty(RDF.type, CURIE.CuriePrefixBinding);
      bindingNode.deleteProperties(CURIE.prefix);
      bindingNode.addProperty(CURIE.prefix, literalFactory.createTypedLiteral(prefix));
      bindingNode.deleteProperties(CURIE.binding);
      bindingNode.addProperty(CURIE.binding, literalFactory.createTypedLiteral(bindingValue));
View Full Code Here

  }

  @Test
  public void testFindConcepts() {
    testedConceptProviderManager.fillConceptProviderList();
    GraphNode proposals = testedConceptsFinder.findConcepts("any");
    Assert.assertEquals(5, proposals.countObjects(QUERYRESULT.concept));
    Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1a));
    Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1b));
    Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1c));
    Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1d));
    Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept2a));
    Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2b));
    Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2c));
    Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2d));
  }
View Full Code Here

    LockableMGraph contentGraph = cgProvider.getContentGraph();
    Lock l = contentGraph.getLock().writeLock();
    l.lock();
    try {
      NonLiteral binding = getBindingWithValue(bindingValue, contentGraph);
      GraphNode bindingNode = new GraphNode(binding, contentGraph);
      bindingNode.deleteProperty(RDF.type, CURIE.CuriePrefixBinding);
      bindingNode.deleteProperties(CURIE.prefix);
      bindingNode.deleteProperties(CURIE.binding);
    } finally {
      l.unlock();
    }
    return RedirectUtil.createSeeOtherResponse("./", uriInfo);
  }
View Full Code Here

  @GET
  public GraphNode list(@Context UriInfo uriInfo) {
    TrailingSlash.enforcePresent(uriInfo);
    TripleCollection resultGraph = new SimpleMGraph();
    LockableMGraph contentGraph = cgProvider.getContentGraph();
    GraphNode result = new GraphNode(new BNode(), new UnionMGraph(resultGraph, contentGraph));
    RdfList list = new RdfList(result);   
    Lock l = contentGraph.getLock().readLock();
    l.lock();
    try {
      Iterator<Triple> greetings = contentGraph.filter(null, RDF.type, CURIE.CuriePrefixBinding);
      while (greetings.hasNext()) {
        list.add(greetings.next().getSubject());
      }
    } finally {
      l.unlock();
    }
    result.addProperty(RDF.type, CURIE.CuriePrefixBindingList);
    result.addProperty(RDF.type, PLATFORM.HeadedPage);
    return result;
  }
View Full Code Here

    LockableMGraph contentGraph = cgProvider.getContentGraph();
    MGraph unionMGraph = new UnionMGraph(resultGraph, contentGraph);
    Lock l = contentGraph.getLock().readLock();
    l.lock();
    try {
      GraphNode result = new GraphNode(getBindingWithValue(bindingValue, contentGraph), unionMGraph);
      result.addProperty(RDF.type, PLATFORM.HeadedPage);
      return result;
    } finally {
      l.unlock();
    }
  }
View Full Code Here

    try {
      NonLiteral binding = getBindingWithValue(iriPrefix, contentGraph);
      if (binding == null) {
        return null;
      }
      GraphNode graphNode = new GraphNode(binding, contentGraph);
      return ((Literal)graphNode.getObjects(CURIE.prefix).next()).getLexicalForm();
    } finally {
      l.unlock();
    }
  }
View Full Code Here

      secondSimpleAnnotation.setBegin(32);
      secondSimpleAnnotation.setEnd(44);
      secondSimpleAnnotation.addToIndexes();

      MGraph mGraph = new SimpleMGraph();
      GraphNode node = new GraphNode(new UriRef(cas.toString()), mGraph);

      UIMAUtils.enhanceNode(node, UIMAUtils.getAllAnnotationsOfType(Annotation.type, cas));


    } catch (Exception e) {
View Full Code Here

  public void checkMenu() throws Exception {
    Assert.assertTrue(webServerExist);
    UserContextProvider contextProvider = (UserContextProvider)
        waitFor(UserContextProvider.class, 300000);
    Assert.assertTrue(contextProvider != null);
    GraphNode node = new GraphNode(new BNode(), new SimpleMGraph());
    contextProvider.addUserContext(node);
    Iterator<Resource> iter = node.getObjects(GLOBALMENU.globalMenu);
    Assert.assertTrue(iter.hasNext());
    TripleCollection graph = node.getGraph();
    RdfList list = new RdfList((NonLiteral)iter.next(), graph);
    Assert.assertEquals(3, list.size());
    Assert.assertEquals(GlobalMenuItemsProviderA.groupALabel,
        getLabel(graph, list.get(0)));
    Assert.assertEquals(GlobalMenuItemsProviderA.groupCLabel,
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.utils.GraphNode

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.