Examples of JenaGraph


Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

    private void indexOntology(String userOntologyURI) throws SearchException {
        OntModel userGraph = null;
        MGraph mgraph = tcManager.getMGraph(new UriRef(userOntologyURI));
        if (mgraph != null) {
            JenaGraph jenaGraph = new JenaGraph(mgraph);
            Model model = ModelFactory.createModelForGraph(jenaGraph);
            userGraph = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RDFS_INF);
            userGraph.add(model);
            IndexingHelper.addIndexPropertyToOntResources(userGraph);
        } else {
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

        if (modelExists(ontologyURI)) {
            graph = tcManager.getMGraph(new UriRef(ontologyURI));
        } else {
            graph = tcManager.createMGraph(new UriRef(ontologyURI));
        }
        JenaGraph jenaGraph = new JenaGraph(graph);
        Model model = ModelFactory.createModelForGraph(jenaGraph);
        return model;
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

        if (modelExists(ontologyURI)) {
            deleteModel(ontologyURI);
        }
        MGraph graph = tcManager.createMGraph(new UriRef(ontologyURI));
        JenaGraph jenaGraph = new JenaGraph(graph);
        Model model = ModelFactory.createModelForGraph(jenaGraph);
        model.read(bais, ontologyURI);

        if (model.supportsTransactions()) {
            model.commit();
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

public class JenaParserProvider implements ParsingProvider {

    @Override
    public void parse(MGraph target, InputStream serializedGraph, String formatIdentifier, UriRef baseUri) {
        String jenaFormat = getJenaFormat(formatIdentifier);
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(target);
        Model model = ModelFactory.createModelForGraph(graph);
        String base;
        if (baseUri == null) {
            base = "http://relative-uri.fake/";
        } else {
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

public class RoundTripTest {

    @Test
    public void addAndCount() {
        MGraph mGraph = new SimpleMGraph();
        Graph jenaGraph = new JenaGraph(mGraph);
        Model model = ModelFactory.createModelForGraph(jenaGraph);
        model.add(DC.title, RDFS.label, "title");
        MGraph rewrappedMGraph = new JenaGraphAdaptor(jenaGraph);
        Assert.assertEquals(1, rewrappedMGraph.size());
        rewrappedMGraph.add(new TripleImpl(new BNode(), SKOS.prefLabel,
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

    @Override
    public void serialize(OutputStream serializedGraph, TripleCollection tc,
            String formatIdentifier) {
        String jenaFormat = getJenaFormat(formatIdentifier);
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(tc);
        Model model = ModelFactory.createModelForGraph(graph);
        RDFWriter writer = model.getWriter(jenaFormat);
        if ("RDF/XML".equals(jenaFormat)) {
            //jena complains about some URIs that aren't truely bad
            //see: http://tech.groups.yahoo.com/group/jena-dev/message/38313
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

    private MGraph mGraph;

    private void initializeGraph() {
        mGraph = new SimpleMGraph();
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
        Model model = ModelFactory.createModelForGraph(graph);
        // create the resource
        // and add the properties cascading style
        String URI = "http://example.org/";
        model.createResource(URI + "A").addProperty(
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

        // that the two graphs are equals
        Assert.assertEquals(deserializedGraph.size(), mGraph.getGraph().size());
        Assert.assertEquals(deserializedGraph.hashCode(), mGraph.getGraph()
                .hashCode());
        // isomorphism delegated to jena
        JenaGraph jenaGraphFromNTriples = new JenaGraph(deserializedGraph);
        JenaGraph jenaGraphFromTurtle = new JenaGraph(mGraph.getGraph());
        Assert.assertTrue(jenaGraphFromNTriples
                .isIsomorphicWith(jenaGraphFromTurtle));
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

        Assert.assertEquals(mGraph.getGraph(), deserializedGraph);
    }

    private Graph parse(InputStream serializedGraph, String jenaFormat) {
        MGraph mResult = new SimpleMGraph();
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mResult);
        Model model = ModelFactory.createModelForGraph(graph);
        String base = "urn:x-relative:";
        model.read(serializedGraph, base, jenaFormat);
        return mResult.getGraph();
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.jena.facade.JenaGraph

   
    }

    @Override
    public Graph getDefaultGraph() {
        final JenaGraph jenaGraph = new JenaGraph(defaultGraph);
        return jenaGraph;
    }
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.