Package com.tinkerpop.blueprints.impls.sail

Examples of com.tinkerpop.blueprints.impls.sail.SailGraph$SailAdder


    private SailGraph sailGraph;

    @Before
    public void setUp() throws Exception {
        sail = new MemoryStore();
        sailGraph = new SailGraph(sail);
    }
View Full Code Here


    public Response getPrefixes(@PathParam("graphname") String graphName) {

        final RexsterApplicationGraph rag = this.getRexsterApplicationGraph(graphName);

        try {
            final SailGraph graph = ((SailGraph) rag.getUnwrappedGraph());
            final JSONArray results = new JSONArray();
            for (final Map.Entry<String, String> entry : graph.getNamespaces().entrySet()) {
                JSONObject result = new JSONObject();
                result.put(entry.getKey(), entry.getValue());
                results.put(result);
            }
View Full Code Here

    @Timed(name = "http.rest.prefixes.object.get", absolute = true)
    public Response getSinglePrefix(@PathParam("graphname") String graphName, @PathParam("prefix") String prefix) {

        final RexsterApplicationGraph rag = this.getRexsterApplicationGraph(graphName);
        try {
            final SailGraph graph = ((SailGraph) rag.getUnwrappedGraph());
            this.resultObject.put(Tokens.RESULTS, graph.getNamespaces().get(prefix));
            this.resultObject.put(Tokens.QUERY_TIME, this.sh.stopWatch());

            return Response.ok(this.resultObject).build();
        } catch (JSONException ex) {
            logger.error(ex);
View Full Code Here

    @Timed(name = "http.rest.prefixes.object.delete", absolute = true)
    public Response deleteSinglePrefix(@PathParam("graphname") String graphName, @PathParam("prefix") String prefix) {

        final RexsterApplicationGraph rag = this.getRexsterApplicationGraph(graphName);
        try {
            final SailGraph graph = ((SailGraph) rag.getUnwrappedGraph());
            graph.removeNamespace(prefix);

            rag.tryCommit();

            this.resultObject.put(Tokens.QUERY_TIME, this.sh.stopWatch());
View Full Code Here

            final JSONObject error = generateErrorObject("Parameters 'prefix' and 'namespace' required");
            throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(error).build());
        }

        try {
            final SailGraph graph = ((SailGraph) rag.getUnwrappedGraph());
            graph.addNamespace(reqObject.optString("prefix"), reqObject.optString("namespace"));

            rag.tryCommit();

            this.resultObject.put(Tokens.QUERY_TIME, this.sh.stopWatch());
View Full Code Here

                && (graphFile == null || graphFile.trim().length() == 0)) {
            throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_LOCATION);
        }

        try {
            SailGraph graph = null;

            if (this.sailType.equals(SAIL_TYPE_MEMORY)) {

                if (graphFile != null && !graphFile.isEmpty()) {
                    logger.warn("[" + MemoryStoreSailGraph.class.getSimpleName() + "] doesn't support the graph-file parameter.  It will be ignored.");
View Full Code Here

    private RexsterResourceContext ctx;

    @Before
    public void beforeTest() {

        SailGraph sailGraph = new MemoryStoreSailGraph();
        SailGraphFactory.createTinkerGraph(sailGraph);

        this.graph = sailGraph;

    }
View Full Code Here

                    generateErrorJson(extMethod.getExtensionApiAsJson()));
        }

        try {

            final SailGraph sailGraph = (SailGraph) graph;
            final List<Map<String, Vertex>> sparqlResults = sailGraph.executeSparql(queryString);

            final JSONArray jsonArray = new JSONArray();

            for (Map<String, Vertex> map : sparqlResults) {
                Map<String, JSONObject> mapOfJson = new HashMap<String, JSONObject>();
View Full Code Here

        else
            logger.info(name + ": " + eventName + " in " + timeInMilliseconds + "ms");
    }

    protected ResourceHolder<PrefixResource> constructPrefixResource() {
        final SailGraph sg = new MemoryStoreSailGraph();
        SailGraphFactory.createTinkerGraph(sg);

        // have to reset with a sail graph for prefixes to work. empty graph is not used
        // in these tests so no need to reset.
        this.createDefaultGraphs(sg, this.emptyGraph);
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.impls.sail.SailGraph$SailAdder

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.