Examples of TripleImpl


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

     * Adds a new graphname to the index of graphnames 
     * @param graphName name of the graph
     * @param graphType resourcetype for the graph to add.
     */
    private void addToIndex(UriRef graphName, UriRef graphType) {
        graphNameIndex.getMGraph().add(new TripleImpl(graphName, RDF.type, graphType));
        graphNameIndex.sync();
    }
View Full Code Here

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

    @Test
    public void serializeGraph() {
        final String uriString = "http://example.org/foo#bar";
        UriRef uri = new UriRef(uriString);
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uri, uri, new PlainLiteralImpl("bla bla")));
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
        Model model = ModelFactory.createModelForGraph(graph);
        StringWriter writer = new StringWriter();
        model.write(writer);
        Assert.assertTrue(writer.toString().contains("about=\""+uriString));
View Full Code Here

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

   
    @Test
    public void graphSize() {
        UriRef uri = new UriRef("http://example.org/foo#bar");
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uri, uri, new PlainLiteralImpl("bla bla")));
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
        Assert.assertEquals(1, graph.size());
    }
View Full Code Here

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

        add(randomTriple);
        return randomTriple;
    }
   
    private Triple createRandomTriple() {
        return new TripleImpl(getSubject(), getPredicate(), getObject());
    }
View Full Code Here

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

    @Test
    public void testCreateGraph() {
        TcProvider simpleTcmProvider = getInstance();
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));

        Graph createdGraph = simpleTcmProvider.createGraph(uriRefA, mGraph);

        Iterator<Triple> iteratorInput = mGraph.iterator();
        Iterator<Triple> iteratorCreated = createdGraph.iterator();
View Full Code Here

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

    @Test
    public void testGetGraph() {
        TcProvider simpleTcmProvider = getInstance();
        // add Graphs
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
        simpleTcmProvider.createGraph(uriRefA, mGraph);
        mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
        simpleTcmProvider.createGraph(uriRefA1, mGraph);
        mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
        simpleTcmProvider.createGraph(uriRefB, mGraph);
        mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));
        simpleTcmProvider.createGraph(uriRefB1, mGraph);

        Graph bGraph = simpleTcmProvider.getGraph(uriRefB);
        Iterator<Triple> iterator = bGraph.iterator();
        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
        assertFalse(iterator.hasNext());
    }
View Full Code Here

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

    @Test
    public void testGetMGraph() {
        TcProvider simpleTcmProvider = getInstance();
        // add MGraphs
        MGraph mGraph = simpleTcmProvider.createMGraph(uriRefA);
        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
        mGraph = simpleTcmProvider.createMGraph(uriRefA1);
        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
        mGraph = simpleTcmProvider.createMGraph(uriRefB);
        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefA));
        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
        mGraph.remove(new TripleImpl(uriRefB, uriRefB, uriRefA));
        assertEquals(1, mGraph.size());
        mGraph = simpleTcmProvider.createMGraph(uriRefB1);
        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));

        MGraph bGraph = simpleTcmProvider.getMGraph(uriRefB);
        Iterator<Triple> iterator = bGraph.iterator();
        assertEquals(new TripleImpl(uriRefB, uriRefB, uriRefB), iterator.next());
        assertFalse(iterator.hasNext());
    }
View Full Code Here

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

    @Test
    public void testGetTriples() {
        TcProvider simpleTcmProvider = getInstance();
        // add Graphs
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
        simpleTcmProvider.createGraph(uriRefA, mGraph);
        mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefB, uriRefB, uriRefB));
        simpleTcmProvider.createGraph(uriRefB, mGraph);
        // add MGraphs
        mGraph = simpleTcmProvider.createMGraph(uriRefA1);
        mGraph.add(new TripleImpl(uriRefA1, uriRefA1, uriRefA1));
        mGraph = simpleTcmProvider.createMGraph(uriRefB1);
        mGraph.add(new TripleImpl(uriRefB1, uriRefB1, uriRefB1));

        // get a Graph
        TripleCollection tripleCollection = simpleTcmProvider.getTriples(uriRefA);
        // get a MGraph
        TripleCollection tripleCollection2 = simpleTcmProvider.getTriples(uriRefB1);

        Iterator<Triple> iterator = tripleCollection.iterator();
        assertEquals(new TripleImpl(uriRefA, uriRefA, uriRefA), iterator.next());
        assertFalse(iterator.hasNext());

        iterator = tripleCollection2.iterator();
        assertEquals(new TripleImpl(uriRefB1, uriRefB1, uriRefB1), iterator.next());
        assertFalse(iterator.hasNext());
    }
View Full Code Here

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

    @Test
    public void testDeleteEntity() {
        TcProvider simpleTcmProvider = getInstance();
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
        Graph graph = mGraph.getGraph();
        simpleTcmProvider.createGraph(uriRefA, graph);
        simpleTcmProvider.createGraph(uriRefC, graph);

        simpleTcmProvider.deleteTripleCollection(uriRefA);
View Full Code Here

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

    private Triple createTestTriple() {
        NonLiteral subject = new BNode() {};
        UriRef predicate = new UriRef("http://test.com/");
        NonLiteral object = new UriRef("http://test.com/myObject");
        return new TripleImpl(subject, predicate, object);
    }
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.