Examples of SailGraph


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

    private SailGraph sailGraph;

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

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

    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

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

    @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

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

    @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

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

            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

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

                && (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

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

    private RexsterResourceContext ctx;

    @Before
    public void beforeTest() {

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

        this.graph = sailGraph;

    }
View Full Code Here

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

                    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

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

        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

Examples of com.tinkerpop.blueprints.pgm.impls.sail.SailGraph

  public static void main(String[] args) throws Exception {

    final Server server = new Server(8081);
    final Neo4jGraph neo  = new Neo4jGraph("dbpedia4neo");
    final GraphSail gsail = new GraphSail(neo);
    final SailGraph sail  = new SailGraph(gsail);
   
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        server.setHandler(context);
               
        // set the query handler
        context.addServlet(new ServletHolder(new QueryHandler(sail)), "/query");
       
    // we need a clean shutdown
        Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
        try {
          System.out.println("Shutting down...");
          server.stop();
          sail.shutdown();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
        });
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.