Package virtuoso.jena.driver

Examples of virtuoso.jena.driver.VirtGraph


   
    /** connects to the default graph */
    _Conn() throws ServletException {
      log.info("Connecting to triple store...");
      try {
        _graph = new VirtGraph(_host, _username, _password);
        _model = ModelFactory.createModelForGraph(_graph);
      }
      catch (Throwable e) {
        throw new ServletException("Error connecting to triple store server.", e);
      }
View Full Code Here


    /** connects to a particular graph */
    _Conn(String graphName) throws ServletException {
      log.info("Connecting to triple store, graphName=" +graphName);
      try {
        _graph = new VirtGraph(graphName, _host, _username, _password);
        _model = ModelFactory.createModelForGraph(_graph);
      }
      catch (Throwable e) {
        throw new ServletException("Error connecting to triple store server.", e);
      }
View Full Code Here

 
  private VirtGraph graph = null;
 
  public RDFHandler(){
    //graph = new VirtGraph ("jdbc:virtuoso://localhost:1111", "dba", "dba");
    graph = new VirtGraph ("jdbc:virtuoso://bioonto.gen.cam.ac.uk:1111", "dba", "dba");
  }
View Full Code Here

    _queryExactMatch();
    _queryWithInference();
  }
 
  static void _clearGraph() {
    VirtGraph _graph = new VirtGraph (TEST_GRAPH, _host, _username, _password);
    _graph.clear();
    System.out.println("clear done.  graph size = " +_graph.size());
    _graph.close();
  }
View Full Code Here

   * <li> BBB skos:exactMatch CCC
   * <li> CCC skos:exactMatch DDD
   * </ul>
   */
  static void _loadTestModel() {
    VirtGraph _graph = new VirtGraph (TEST_GRAPH, _host, _username, _password);
    Model _model = ModelFactory.createModelForGraph(_graph);
   
    _model.read("file:" +TEST_MODEL);
    System.out.println("Model read.  graph size = " +_graph.size());
   
    _graph.close();
  }
View Full Code Here

    _graph.close();
  }

  /** { ?s skos:exactMatch ?o } */
  private static void _queryExactMatch() {
    VirtGraph _graph = new VirtGraph (TEST_GRAPH, _host, _username, _password);
    Query sparql = QueryFactory.create(
        "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> " +
        "SELECT * WHERE { ?s skos:exactMatch ?o } ");

    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, _graph);

    ResultSet results = vqe.execSelect();
    System.out.println("RESULT:");
    while (results.hasNext()) {
      QuerySolution result = results.nextSolution();
        RDFNode s = result.get("s");
        RDFNode o = result.get("o");
        System.out.println("  " + s + " " + "skos:exactMatch" + " " + o);
    }
   
    vqe.close();
    _graph.close();

  }
View Full Code Here

http://example.org/vocres/CCC
http://example.org/vocres/DDD
   * </pre>
   */
  private static void _queryWithInference() {
    VirtGraph _graph = new VirtGraph (TEST_GRAPH, _host, _username, _password);
    String queryString =
      "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> " +
      "SELECT ?o WHERE " +
      "{ <http://example.org/vocres/AAA> " +
      "  skos:exactMatch " +
      "  ?o " +
      "  OPTION(TRANSITIVE)" // <<-- Jena triggers error here; but Virtuoso handles it
      "} "
    ;
   
    // with the OPTION(TRANSITIVE) above, Jena triggers syntax error here:
//    Query sparql = QueryFactory.create(queryString);
   
    // but passing the string directly to Virtuoso is fine:
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(
//        sparql,
        queryString,
        _graph);
   
    // and the result includes the inferred triples:
//    RESULT:
//       http://example.org/vocres/BBB
//       http://example.org/vocres/CCC
//       http://example.org/vocres/DDD
        
    ResultSet results = vqe.execSelect();
    System.out.println("RESULT:");
    while (results.hasNext()) {
      QuerySolution result = results.nextSolution();
      RDFNode o = result.get("o");
      System.out.println(" "+ o );
    }
   
    vqe.close();
    _graph.close();
  }
View Full Code Here

//    _removeGraph(null);
    _removeGraph("");
  }
 
  private static void _removeGraph(String graphName) {
    VirtGraph set;
    if ( graphName != null ) {
      set = new VirtGraph(graphName, _host, _username, _password);
    }
    else {
      set = new VirtGraph (_host, _username, _password);
    }
   
    System.out.println("graphName=" +graphName+ " size = " +set.size());
    set.clear();
    System.out.println("graphName=" +graphName+ " size = " +set.size());
  }
View Full Code Here

    url = System.getProperty("url");
                if(url == null)
//                    url = "jdbc:virtuoso://mf64:1111";
                    url = "jdbc:virtuoso://mc64:1111";

    graph = new VirtGraph("http://example.org/testing", url, "dba", "dba");
    graph1 = new VirtGraph("http://example.org/testing1", url, "dba", "dba");
    }
View Full Code Here

    url = System.getProperty("url");
                if(url == null)
                    url = "jdbc:virtuoso://localhost:1111";

    graph = new VirtGraph("http://example.org/testing", url, "dba", "dba");
  }
View Full Code Here

TOP

Related Classes of virtuoso.jena.driver.VirtGraph

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.