Package org.apache.clerezza.rdf.core

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


    resultSet= toCollection(iterator);
    Assert.assertEquals(1, resultSet.size());
    Assert.assertTrue(resultSet.contains(tripleBob));

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


    resultSet= toCollection(iterator);
    Assert.assertEquals(1, resultSet.size());
    Assert.assertTrue(resultSet.contains(tripleAlice));

    // Find both
    iterator = graph.filter(null, null, null);
    resultSet= toCollection(iterator);
    Assert.assertEquals(2, resultSet.size());
    Assert.assertTrue(resultSet.contains(tripleAlice));
    Assert.assertTrue(resultSet.contains(tripleBob));
  }
View Full Code Here

    mGraph.add(trpl1);
    mGraph.add(trpl2);
    mGraph.add(trpl3);
    mGraph.add(trpl4);
    listener.resetCumulatedEvents();
    Iterator<Triple> result = mGraph.filter(null, uriRef2, null);
    while (result.hasNext()) {
      result.next();
      result.remove();
    }
    List<GraphEvent> cumulatedEvents = listener.getCumulatedEvents();
View Full Code Here

    }
    MGraph contentGraph = cgProvider.getContentGraph();
    PlainLiteral preferredLabel = new PlainLiteralImpl(prefLabel,
        new Language(lang));

    if (contentGraph.filter(null, SKOS.prefLabel, preferredLabel).hasNext()) {
      return Response.status(Status.CONFLICT)
          .entity("A concept with the same label and language already exists!")
          .build();
    }
   
View Full Code Here

    NonLiteral cplNode = getConceptProviderListNode(contentGraph);
    RdfList cpl = new RdfList(cplNode, contentGraph);
    for (int i = 0; i < cpl.size(); i++) {
      NonLiteral conceptProvider = (NonLiteral) cpl.get(i);
      Iterator<Triple> conceptProviderTypes = contentGraph.filter(
          conceptProvider, RDF.type, null);
      if (conceptProviderTypes.hasNext()) {
        UriRef conceptProviderType = (UriRef) conceptProviderTypes.next().getObject();
        if (conceptProviderType.equals(CONCEPTS.LocalConceptProvider)) {
          instantiateLocalConceptProvider(contentGraph, conceptProvider);
View Full Code Here

  private MGraph getCachedConcepts(GraphNode conceptCacheEntryGraphNode) {
    MGraph resultMGraph = new SimpleMGraph();
    MGraph conceptCacheMGraph = (MGraph) conceptCacheEntryGraphNode.getGraph();
    NonLiteral conceptCacheNode = (NonLiteral) conceptCacheEntryGraphNode.getNode();
    Iterator<Triple> triples = conceptCacheMGraph.filter(
        conceptCacheNode, CONCEPTS.searchResult, null);
    while (triples.hasNext()) {
      UriRef concept = (UriRef) triples.next().getObject();
      GraphNode graphNode = new GraphNode(concept, conceptCacheMGraph);
      resultMGraph.add(new TripleImpl(concept, RDF.type, SKOS.Concept));
View Full Code Here

    UriRef property = new UriRef("http://example.com/property");
    Triple triple = new TripleImpl(new BNode(), property, dateLiteral);
    graph.add(triple);

    Triple tripleFromGraph = null;
    Iterator<Triple> propertyTriples = graph.filter(null, property, dateLiteral);
    if (propertyTriples.hasNext()) {
      tripleFromGraph = propertyTriples.next();
    } else {
      Assert.assertTrue(false);
    }
View Full Code Here

  predicates.add(new PropertyHolder(FOAF.lastName));

  List<VirtualProperty>  properties = new java.util.ArrayList<VirtualProperty>();
  properties.add(new JoinVirtualProperty(predicates));
    indexDefinitionManager.addDefinitionVirtual(FOAF.Person, properties);
    Iterator<Triple> typeStmtIter = indexManagerGraph.filter(null, RDF.type, CRIS.JoinVirtualProperty);
    Assert.assertTrue(typeStmtIter.hasNext());
    //Assert.assertEquals(manuallyCreatedGraph.getGraph, indexManagerGraph.getGraph)
  }
}
View Full Code Here

    ParsingProvider provider = new RdfJsonParsingProvider();
    InputStream jsonIn = getClass().getResourceAsStream("test-object-bnode.json");
    MGraph parsedMGraph = new SimpleMGraph();
    provider.parse(parsedMGraph, jsonIn, "application/rdf+json", null);
    Assert.assertEquals(parsedMGraph.size(), 1);
    Iterator<Triple> triples = parsedMGraph.filter(new UriRef("http://example.org/node1"),
        new UriRef("http://example.org/prop1"), null);
    Assert.assertTrue(triples.hasNext());
    Assert.assertTrue(triples.next().getObject() instanceof BNode);
  }
View Full Code Here

    ParsingProvider provider = new RdfJsonParsingProvider();
    InputStream jsonIn = getClass().getResourceAsStream("test-subject-bnode.json");
    MGraph parsedMGraph = new SimpleMGraph();
    provider.parse(parsedMGraph, jsonIn, "application/rdf+json", null);
    Assert.assertEquals(3, parsedMGraph.size());
    Iterator<Triple> triples = parsedMGraph.filter(null, new UriRef("http://example.org/prop1"),
        new UriRef("http://example.org/node1"));
    Assert.assertTrue(triples.hasNext());
    NonLiteral subject = triples.next().getSubject();
    Assert.assertTrue(subject instanceof BNode);
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.