Package org.apache.clerezza.rdf.core.impl

Examples of org.apache.clerezza.rdf.core.impl.SimpleMGraph


    };
    final ContentGraphProvider cgProvider = new ContentGraphProvider() {

      @Override
      public LockableMGraph getContentGraph() {
        return new LockableMGraphWrapper(new SimpleMGraph());
      }

    };

    testedConceptProviderManager = new TestedConceptProviderManager();
View Full Code Here


      Annotation secondSimpleAnnotation = new Annotation(cas);
      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));

View Full Code Here

  @Test
  public void removeSubGraph() throws NoSuchSubGraphException {
    MGraph baseGraph = createBaseGraph();

    MGraph subGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      subGraph.add(new TripleImpl(u1, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode1));
    }
    MGraphUtils.removeSubGraph(baseGraph, subGraph);
    Assert.assertEquals(1, baseGraph.size());
  }
View Full Code Here

    MGraphUtils.removeSubGraph(baseGraph, subGraph);
    Assert.assertEquals(1, baseGraph.size());
  }

  private MGraph createBaseGraph() {
    MGraph baseGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      baseGraph.add(new TripleImpl(u1, u2, bNode2));
      baseGraph.add(new TripleImpl(bNode2, u2, bNode2));
      baseGraph.add(new TripleImpl(bNode2, u2, bNode1));
      baseGraph.add(new TripleImpl(u3, u2, u1));
    }
    return baseGraph;
  }
View Full Code Here

*/
public class SimpleTest {

  @Test
  public void simpleSelectQuery() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "SELECT ?title WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
        "}";
View Full Code Here

   */
  @Test(expected=NoSuchSubGraphException.class)
  public void removeIncompleteSubGraph() throws NoSuchSubGraphException {
    MGraph baseGraph = createBaseGraph();

    MGraph subGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      subGraph.add(new TripleImpl(u1, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode2));
    }
    MGraphUtils.removeSubGraph(baseGraph, subGraph);
  }
View Full Code Here

        ((Literal)resultSet.next().get("title")).getLexicalForm());
  }

  @Test
  public void simpleAskQuery() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "ASK WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
        "}";
View Full Code Here

  @Test(expected=NoSuchSubGraphException.class)
  public void removeInvalidSubGraph() throws NoSuchSubGraphException {
    MGraph baseGraph = createBaseGraph();

    MGraph subGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      subGraph.add(new TripleImpl(u1, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode2));
      baseGraph.add(new TripleImpl(bNode2, u2, bNode1));
      baseGraph.add(new TripleImpl(bNode2, u2, new BNode()));
    }
    MGraphUtils.removeSubGraph(baseGraph, subGraph);
  }
View Full Code Here

        QueryParser.getInstance().parse(query), data));
  }

  @Test
  public void simpleDescribe() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "DESCRIBE "+
        "  <http://example.org/book/book1>";
    Assert.assertEquals(1,
        ((Graph)TcManager.getInstance().executeSparqlQuery(
View Full Code Here

        QueryParser.getInstance().parse(query), data)).size());
  }

  @Test
  public void simpleConstruct() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "PREFIX foaf:   <http://xmlns.com/foaf/0.1/> " +
        "CONSTRUCT { <http://foo/bar> foaf:name ?title } WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.impl.SimpleMGraph

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.