Package org.apache.clerezza.rdf.core

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


        //parse the default graph name
        value = config.get(DEFAULT_GRAPH_NAME);
        if(value != null && !value.toString().isEmpty()){
            try {
                new URI(value.toString());
                defaultGraphName = new UriRef(value.toString());
            } catch (URISyntaxException e) {
                throw new ConfigurationException(DEFAULT_GRAPH_NAME, "The parsed name '"
                        + value + "'for the default graph (union over all "
                        + "named graphs managed by this Jena TDB dataset) MUST BE "
                        + "an valid URI or NULL do deactivate this feature!",e);
View Full Code Here


        Set<UriRef> graphNames = new HashSet<UriRef>();
        datasetLock.readLock().lock();
        try {
            for(Iterator<String> names = getDataset().listNames();
                names.hasNext();
                    graphNames.add(new UriRef(names.next())));
        } finally {
            datasetLock.readLock().unlock();
        }
        if(defaultGraphName != null){
            graphNames.add(defaultGraphName);
View Full Code Here

//            }
        } else { //read pre-existing models in the dataset
            datasetLock.readLock().lock();
            try {
                for(Iterator<String> it = getDataset().listNames();it.hasNext();){
                    mGraphNames.add(new UriRef(it.next()));
                }
                writeMGraphConfig();
            } finally {
                datasetLock.readLock().unlock();
            }
View Full Code Here

            }
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                new FileInputStream(file),UTF8));
            String line = reader.readLine();
            while (line != null) {
                names.add(new UriRef(line));
                line = reader.readLine();
            }
            reader.close();
            return true;
        } else {// no config file indicates first initialisation
View Full Code Here

        //parse the default graph name
        value = config.get(DEFAULT_GRAPH_NAME);
        if(value != null && !value.toString().isEmpty()){
            try {
                new URI(value.toString());
                defaultGraphName = new UriRef(value.toString());
            } catch (URISyntaxException e) {
                throw new ConfigurationException(DEFAULT_GRAPH_NAME, "The parsed name '"
                        + value + "'for the default graph (union over all "
                    + "named graphs managed by this Jena TDB dataset) MUST BE "
                        + "an valid URI or NULL do deactivate this feature!",e);
View Full Code Here

        //TODO: this method would require to compare the triples within the graph
        //      because an equals check will not work with BNodes.
        Set<UriRef> graphNames = new HashSet<UriRef>();
        for( Iterator<Triple> iterator = graphNameIndex.getMGraph().iterator(); iterator.hasNext(); ) {
            Triple triple = iterator.next();
            UriRef graphName = new UriRef(triple.getSubject().toString());
            Graph currentGraph = getModelGraph(graphName, false, false).getGraph();
            if(graph.equals(currentGraph)){
                graphNames.add(graphName);
            }
        }
View Full Code Here

public class TestBasics {
   
    @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();
View Full Code Here

        Assert.assertTrue(writer.toString().contains("about=\""+uriString));
    }
   
    @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

    private void loadGraphs() {
        File graphsDir = new File(new File(dataPathString), "graph");
        if (graphsDir.exists()) {
            for (String graphDirName : graphsDir.list()) {
                try {
                    UriRef uri = new UriRef(URLDecoder.decode(graphDirName, "utf-8"));
                    log.info("loading: "+graphDirName);
                    graphMap.put(uri, getGraph(new File(graphsDir, graphDirName)));
                } catch (UnsupportedEncodingException ex) {
                    throw new RuntimeException("utf-8 not supported", ex);
                } catch (Exception e) {
View Full Code Here

    private void loadMGraphs() {
        File mGraphsDir = new File(new File(dataPathString), "mgraph");
        if (mGraphsDir.exists()) {
            for (String mGraphDirName : mGraphsDir.list()) {
                try {
                    UriRef uri = new UriRef(URLDecoder.decode(mGraphDirName, "utf-8"));
                    log.info("loading: "+mGraphDirName);
                    mGraphMap.put(uri, new LockableMGraphWrapper(getMGraph(new File(mGraphsDir, mGraphDirName))));
                } catch (UnsupportedEncodingException ex) {
                    throw new RuntimeException("utf-8 not supported", ex);
                } catch (Exception e) {
View Full Code Here

TOP

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

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.