Package org.wikier.trioo.jtrioo.generators

Examples of org.wikier.trioo.jtrioo.generators.QueryCodeGenerator


      return null;
    } else {
      SelectQueryGenerator sqg = QueryGeneratorFactory.createSelectQueryGenerator();
      sqg.setUri(uri);
      sqg.visit(metaResource);
      QueryCodeGenerator qg = new QueryCodeGenerator();
      qg.visit(sqg.getQuery());
      QueryExecutor qe = this.session.getQueryExecutor();
      ResultSet rs = qe.execSelect(qg.toString());
      Object obj = null;
      if (rs.hasNext()) {
        obj = InstanceGenerator.create(resourceClass, rs.next());
      }
      rs = null; //FIXME: how a ResultSet can be closed?
View Full Code Here


  public Object find(String uri) {
    SelectQuery q = new SelectQuery();
    Variable x = new Variable("x");
    q.addTriplePattern(new TriplePattern(x, new AbbrevRdfType(), new Variable("type")));
    q.addFilter("str(" + x.toString() +") = \"" + uri + "\"");
    QueryCodeGenerator qg = new QueryCodeGenerator();
    qg.visit(q);
    QueryExecutor qe = this.session.getQueryExecutor();
    ResultSet rs = qe.execSelect(qg.toString());
    RDFMetaResource metaResource = new RDFMetaResource(Object.class);
    while (rs.hasNext()) {
      QuerySolution qs = rs.nextSolution();
      RDFNode node  = qs.get("type");
      if (node.isURIResource()) {
View Full Code Here

    if (metaResource == null) {
      return new Object[]{};
    } else {
      SelectQueryGenerator sqg = QueryGeneratorFactory.createSelectQueryGenerator();
      sqg.visit(metaResource);
      QueryCodeGenerator qg = new QueryCodeGenerator();
      qg.visit(sqg.getQuery());
      QueryExecutor qe = this.session.getQueryExecutor();
      ResultSet rs = qe.execSelect(qg.toString());
      List<Object> objs = new ArrayList<Object>();
      while (rs.hasNext()) {
        objs.add(InstanceGenerator.create(resourceClass, rs.next()));
      }
      rs = null; //FIXME: how a ResultSet can be closed?
View Full Code Here

      if (metaResource == null) {
        return false;
      } else {
        InsertQueryGenerator iqg = QueryGeneratorFactory.createInsertQueryGenerator();
        iqg.visit(metaResource);
        QueryCodeGenerator qg = new QueryCodeGenerator();
        qg.visit(iqg.getQuery());
        QueryExecutor qe = this.session.getQueryExecutor();
        return qe.execInsert(qg.toString());
      }
    }
  }
View Full Code Here

        return false;
      } else {
        InsertQueryGenerator iqg = QueryGeneratorFactory.createInsertQueryGenerator();
        iqg.setUri(uri);
        iqg.visit(metaResource);
        QueryCodeGenerator qg = new QueryCodeGenerator();
        qg.visit(iqg.getQuery());
        QueryExecutor qe = this.session.getQueryExecutor();
        return qe.execInsert(qg.toString());
      }
    }
  } 
View Full Code Here

    if (metaResource == null) {
      return JenaHelper.createModel();
    } else {
      ConstructQueryGenerator cqg = QueryGeneratorFactory.createConstructQueryGenerator();
      cqg.visit(metaResource);
      QueryCodeGenerator qcg = new QueryCodeGenerator();
      qcg.visit(cqg.getQuery());
      QueryExecutor qe = this.session.getQueryExecutor();
      return qe.execConstruct(qcg.toString());
    }
  }
View Full Code Here

  }
 
  public Model describe(String uri) {
    DescribeQueryGenerator dqg = QueryGeneratorFactory.createDescribeQueryGenerator();
    dqg.visit(uri);
    QueryCodeGenerator qcg = new QueryCodeGenerator();
    qcg.visit(dqg.getQuery());
    QueryExecutor qe = this.session.getQueryExecutor();
    return qe.execDescribe(qcg.toString());
  }
View Full Code Here

      } else {
        InsertQueryGenerator iqg = QueryGeneratorFactory.createInsertQueryGenerator();
        iqg.setResourceManager(this);
        iqg.setObj(resource);
        iqg.visit(metaResource);
        QueryCodeGenerator qcg = new QueryCodeGenerator();
        qcg.visit(iqg.getQuery());
        QueryExecutor qe = this.session.getQueryExecutor();
        Model model = JenaHelper.createModel();
        return qe.execInsert(qcg.toString(), model);
      }
    } else {
      return JenaHelper.createModel();
    }
  }
View Full Code Here

        InsertQueryGenerator iqg = QueryGeneratorFactory.createInsertQueryGenerator();
        iqg.setResourceManager(this);
        iqg.setObj(resource);
        iqg.setUri(uri);
        iqg.visit(metaResource);
        QueryCodeGenerator qcg = new QueryCodeGenerator();
        qcg.visit(iqg.getQuery());
        QueryExecutor qe = this.session.getQueryExecutor();
        Model model = JenaHelper.createModel();
        return qe.execInsert(qcg.toString(), model);
      }
    } else {
      return JenaHelper.createModel();
    }
  }
View Full Code Here

TOP

Related Classes of org.wikier.trioo.jtrioo.generators.QueryCodeGenerator

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.