Examples of GraphImpl


Examples of org.openrdf.model.impl.GraphImpl

  }

  private static Graph doGraphQuery(RepositoryConnection con, String query) throws RepositoryException, MalformedQueryException, QueryEvaluationException {
    GraphQuery resultsTable = con.prepareGraphQuery(QueryLanguage.SPARQL, query);
    GraphQueryResult statements = resultsTable.evaluate();
    Graph g = new GraphImpl();

    Vector<Value[]> results = new Vector<Value[]>();
    for (int row = 0; statements.hasNext(); row++) {
      Statement pairs = statements.next();
      g.add(pairs);
//      List<String> names = statements.getBindingNames();
//      Value[] rv = new Value[names.size()];
//      for (int i = 0; i < names.size(); i++) {
//        String name = names.get(i);
//        Value value = pairs.getValue(name);
View Full Code Here

Examples of org.openrdf.model.impl.GraphImpl

      }
      endTest(ok && result); // should return sz > 0 results 
     
      // do construct
      startTest();
      Graph g = new GraphImpl();
      boolean statementFound = false;
      try {
        ok = true;
        log("Sending construct query");
        query = "CONSTRUCT {?s <http://myopenlink.net/mlo/handle> ?o} FROM <" + context + "> WHERE {?s <http://myopenlink.net/foaf/name> ?o}";
        g = doGraphQuery(con, query);
        Iterator<Statement> it = g.iterator();
        statementFound = true;
        while(it.hasNext()) {
          Statement st = it.next();
          if( !st.getPredicate().stringValue().equals("http://myopenlink.net/mlo/handle")) statementFound = false;
        }
      }
      catch (Exception e) {
        System.out.println("Error[" + e + "]");
        e.printStackTrace();
        ok = false;
      }
      endTest(ok && g.size() > 0); // should return sz > 0 results 
     
      // do describe
      startTest();
      g = new GraphImpl();
      statementFound = false;
      try {
        ok = true;
        log("Sending describe query");
        query = "DESCRIBE ?s FROM <" + context + "> WHERE {?s <http://myopenlink.net/foaf/name> ?o}";
        g = doGraphQuery(con, query);
        Iterator<Statement> it = g.iterator();
        statementFound = it.hasNext();
//        while(it.hasNext()) {
//          Statement st = it.next();
//          if( !st.getPredicate().stringValue().equals("http://myopenlink.net/mlo/handle")) statementFound = false;
//        }
View Full Code Here

Examples of org.openrdf.model.impl.GraphImpl

  }

  private static Graph doGraphQuery(RepositoryConnection con, String query) throws RepositoryException, MalformedQueryException, QueryEvaluationException {
    GraphQuery resultsTable = con.prepareGraphQuery(QueryLanguage.SPARQL, query);
    GraphQueryResult statements = resultsTable.evaluate();
    Graph g = new GraphImpl();

    Vector<Value[]> results = new Vector<Value[]>();
    for (int row = 0; statements.hasNext(); row++) {
      Statement pairs = statements.next();
      g.add(pairs);
//      List<String> names = statements.getBindingNames();
//      Value[] rv = new Value[names.size()];
//      for (int i = 0; i < names.size(); i++) {
//        String name = names.get(i);
//        Value value = pairs.getValue(name);
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.