Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.MGraph.filter()


    MGraph contentGraph = cgProvider.getContentGraph();

    if (!scriptExecutionUri.equals("")) {
      UriRef generatedResourceUri = new UriRef(scriptExecutionUri);
      if (!contentGraph.filter(generatedResourceUri, RDF.type,
          SCRIPT.ScriptGeneratedResource).hasNext()) {
       
        GraphNode generatedResourceNode =
            new GraphNode(generatedResourceUri, contentGraph);
        generatedResourceNode.addProperty(RDF.type,
View Full Code Here


   * @param customfield
   * @return the property UriRef of the customfield
   */
  public UriRef getCustomFieldProperty(NonLiteral customfield){
    MGraph contentGraph = cgProvider.getContentGraph();
    return (UriRef)contentGraph.filter(customfield, CUSTOMPROPERTY.property,
        null).next().getObject();
  }
 
  protected void bindCgProvider(ContentGraphProvider cgProvider) {
    this.cgProvider = cgProvider;
View Full Code Here

    tripleIter = graph.filter(null, uriRef4, null);
    Assert.assertTrue(tripleIter.hasNext());
    Triple retrievedTriple = tripleIter.next();
    Assert.assertFalse(tripleIter.hasNext());
    Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
    tripleIter = graph.filter(uriRef1, uriRef2, null);
    Assert.assertTrue(tripleIter.hasNext());
    retrievedTriple = tripleIter.next();
    Assert.assertFalse(tripleIter.hasNext());
    Assert.assertEquals(retrievedTriple.getSubject(), retrievedTriple.getObject());
  }
View Full Code Here

    MGraph graph = getEmptyMGraph();
    Assert.assertEquals(0, graph.size());
    Literal value = new TypedLiteralImpl("<elem>value</elem>",xmlLiteralType);
    final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
    graph.add(triple1);
    Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
    Assert.assertTrue(tripleIter.hasNext());
    Resource gotValue = tripleIter.next().getObject();
    Assert.assertEquals(value, gotValue);
  }
View Full Code Here

   */
  private Set<NonLiteral> getScriptGeneratedResources(
      NonLiteral scriptResource) {
    MGraph contentGraph = cgProvider.getContentGraph();

    Iterator<Triple> it = contentGraph.filter(null,
        SCRIPT.scriptSource,
        scriptResource);

    Set<NonLiteral> resources = new HashSet<NonLiteral>();

View Full Code Here

    Assert.assertEquals(0, graph.size());
    Language language = new Language("it");
    Literal value = new PlainLiteralImpl("<elem>value</elem>",language);
    final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
    graph.add(triple1);
    Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
    Assert.assertTrue(tripleIter.hasNext());
    Resource gotValue = tripleIter.next().getObject();
    Assert.assertEquals(value, gotValue);
    Assert.assertEquals(language, ((PlainLiteral)gotValue).getLanguage());
  }
View Full Code Here

    final PlainLiteralImpl name2 = new PlainLiteralImpl("http://example.org/people/bob");
    final Triple tripleAlice = new TripleImpl(bNode, HAS_NAME, name);
    final Triple tripleBob = new TripleImpl(bNode, HAS_NAME, name2);
    Assert.assertTrue(graph.add(tripleAlice));
    Assert.assertTrue(graph.add(tripleBob));
    Iterator<Triple> result = graph.filter(null, HAS_NAME, name);
    Assert.assertEquals(bNode, result.next().getSubject());
  }

  @Test
  public void testContainsIfContained() throws Exception {
View Full Code Here


  @Test
  public void testFilterEmptyGraph() throws Exception {
    MGraph graph = getEmptyMGraph();
    Iterator<Triple> i = graph.filter(null, null, null);
    Assert.assertFalse(i.hasNext());
  }


  @Test
View Full Code Here

        "http://example.org/ontology/Person",
        "http://example.org/ontology/hasName",
        "http://example.org/people/alice");
    Assert.assertTrue(graph.add(triple));

    Iterator<Triple> i = graph.filter(null, null, null);
    Collection<Triple> resultSet= toCollection(i);
    Assert.assertEquals(1, resultSet.size());
    Assert.assertTrue(resultSet.contains(triple));
  }
View Full Code Here

    Iterator<Triple> iterator;
    Collection<Triple> resultSet;

    // Find bob
    iterator = graph.filter(null, null,
        new UriRef("http://example.org/people/bob"));
    resultSet= toCollection(iterator);
    Assert.assertEquals(1, resultSet.size());
    Assert.assertTrue(resultSet.contains(tripleBob));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.