Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.Triple



    @Test
    public void testRemoveSingleTriple() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple triple= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        Assert.assertTrue(graph.add(triple));
        Assert.assertTrue(graph.remove(triple));
View Full Code Here


    }

    @Test
    public void testRemoveSameTripleTwice() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple tripleAlice= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        final Triple tripleBob= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/bob");
        Assert.assertTrue(graph.add(tripleAlice));
        Assert.assertTrue(graph.add(tripleBob));
View Full Code Here

        MGraph graph = getEmptyMGraph();
        BNode bNode = new BNode();
        final UriRef HAS_NAME = new UriRef("http://example.org/ontology/hasName");
        final PlainLiteralImpl name = new PlainLiteralImpl("http://example.org/people/alice");
        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());
    }
View Full Code Here

    }

    @Test
    public void testContainsIfContained() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple triple= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        Assert.assertTrue(graph.add(triple));
        Assert.assertTrue(graph.contains(triple));
View Full Code Here


    @Test
    public void testContainsIfEmpty() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple triple= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        Assert.assertFalse(graph.contains(triple));
    }
View Full Code Here


    @Test
    public void testContainsIfNotContained() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple tripleAdd= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        final Triple tripleTest= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/bob");
        Assert.assertTrue(graph.add(tripleAdd));
        Assert.assertFalse(graph.contains(tripleTest));
View Full Code Here


    @Test
    public void testFilterSingleEntry() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple triple= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        Assert.assertTrue(graph.add(triple));
View Full Code Here


    @Test
    public void testFilterByObject() throws Exception {
        MGraph graph = getEmptyMGraph();
        final Triple tripleAlice= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/alice");
        final Triple tripleBob= createTriple(
                "http://example.org/ontology/Person",
                "http://example.org/ontology/hasName",
                "http://example.org/people/bob");
        Assert.assertTrue(graph.add(tripleAlice));
        Assert.assertTrue(graph.add(tripleBob));
View Full Code Here

        MGraph mGraph = getEmptyMGraph();
        TestGraphListener listener = new TestGraphListener();
        mGraph.addGraphListener(listener, new FilterTriple(uriRef1, uriRef2, null),
                1000);

        Triple triple0 = new TripleImpl(uriRef2, uriRef2, literal1);
        Triple triple1 = new TripleImpl(uriRef1, uriRef2, uriRef1);
        Triple triple2 = new TripleImpl(uriRef1, uriRef2, literal1);
        Triple triple3 = new TripleImpl(uriRef1, uriRef2, bnode1);
        mGraph.add(triple0);
        mGraph.add(triple1);
        mGraph.add(triple2);
        mGraph.add(triple3);
        Thread.sleep(1500);
View Full Code Here

    }

    @Test
    public void testCreateGraphWithInitialCollection() throws Exception {

        Triple t1 = createTestTriple();

        TcProvider provider = getInstance();

        Graph graph = provider.createGraph(graphUriRef, createTestTripleCollection(t1));
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.Triple

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.