fr.inria.corese.kgram.core.Query.getExtension()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中fr.inria.corese.kgram.core.Query.getExtension方法的一些代码示例,展示了Query.getExtension的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getExtension方法的具体详情如下:
包路径:fr.inria.corese.kgram.core.Query
类名称:Query
方法名:getExtension

Query.getExtension介绍

暂无

代码示例

代码示例来源:origin: fr.inria.corese/kgram

  1. public boolean hasDefinition(){
  2. return getExtension() != null || getGlobalQuery().getExtension() != null;
  3. }

代码示例来源:origin: fr.inria.corese/kgram

  1. public Extension getCreateExtension() {
  2. if (getExtension() == null){
  3. setExtension(new Extension());
  4. }
  5. return getExtension();
  6. }

代码示例来源:origin: fr.inria.corese/kgram

  1. public Expr getLocalExpression(String name){
  2. if (getExtension() != null){
  3. Expr exp = getExtension().get(name);
  4. if (exp != null){
  5. return exp.getFunction();
  6. }
  7. }
  8. return null;
  9. }

代码示例来源:origin: fr.inria.corese/kgram

  1. public Extension getActualExtension(){
  2. return getGlobalQuery().getExtension();
  3. }

代码示例来源:origin: Wimmics/corese

  1. /**
  2. * templates share profile function definitions
  3. * function st:optimize(){} : run TransformerVisitor to optimize template
  4. */
  5. public void profile() {
  6. Query profile = getTemplate(STL_PROFILE);
  7. if (profile != null) {
  8. if (profile.getExtension() != null) {
  9. // share profile function definitions in templates
  10. fr.inria.corese.compiler.parser.Transformer tr = fr.inria.corese.compiler.parser.Transformer.create();
  11. tr.definePublic(profile.getExtension(), profile, false);
  12. TransformerVisitor tv = new TransformerVisitor(profile.getExtension().get(Transformer.STL_OPTIMIZE) != null);
  13. for (Query t : getTemplates()) {
  14. t.addExtension(profile.getExtension());
  15. tv.visit(t);
  16. }
  17. for (Query t : getNamedTemplates()) {
  18. t.addExtension(profile.getExtension());
  19. tv.visit(t);
  20. }
  21. }
  22. }
  23. }

代码示例来源:origin: fr.inria.corese/compiler

  1. public boolean getLinkedFunction(String label) {
  2. if (! isLinkedFunction()){
  3. return false;
  4. }
  5. String path = NSManager.namespace(label);
  6. if (loaded.containsKey(path)) {
  7. return true;
  8. }
  9. logger.info("Load Linked Function: " + label);
  10. loaded.put(path, path);
  11. Query imp = sparql.parseQuery(path);
  12. if (imp != null && imp.hasDefinition()) {
  13. // loaded functions are exported in Interpreter
  14. definePublic(imp.getExtension(), imp);
  15. return true;
  16. }
  17. return false;
  18. }

代码示例来源:origin: Wimmics/corese

  1. public boolean getLinkedFunction(String label) {
  2. if (! isLinkedFunction()){
  3. return false;
  4. }
  5. String path = NSManager.namespace(label);
  6. if (loaded.containsKey(path)) {
  7. return true;
  8. }
  9. logger.info("Load Linked Function: " + label);
  10. loaded.put(path, path);
  11. Query imp = sparql.parseQuery(path);
  12. if (imp != null && imp.hasDefinition()) {
  13. // loaded functions are exported in Interpreter
  14. definePublic(imp.getExtension(), imp);
  15. return true;
  16. }
  17. return false;
  18. }

代码示例来源:origin: Wimmics/corese

  1. if (qprofile.getExtension() != null){
  2. tr.definePublic(qprofile.getExtension(), qprofile, false);
  3. for (Query t : qe.getTemplates()) {
  4. t.addExtension(qprofile.getExtension());
  5. t.addExtension(qprofile.getExtension());

代码示例来源:origin: Wimmics/corese

  1. Extension ext = q.getExtension();
  2. Transformer t = getTransformer(env, p);

代码示例来源:origin: fr.inria.corese/corese-core

  1. /**
  2. * Default result when all templates fail
  3. */
  4. IDatatype defaut(IDatatype dt, Query q) {
  5. if (isBoolean()) {
  6. return defaultBooleanResult();
  7. }
  8. int ope = defaut;
  9. if (q != null) {
  10. // Expr exp = q.getProfile(STL_DEFAULT);
  11. Extension ext = q.getExtension();
  12. if (ext != null) {
  13. Expr exp = ext.get(STL_DEFAULT);
  14. if (exp != null) {
  15. ope = exp.getBody().oper(); //getExp(1).oper();
  16. }
  17. }
  18. }
  19. return display(dt, ope);
  20. }

代码示例来源:origin: Wimmics/corese

  1. /**
  2. * Default result when all templates fail
  3. */
  4. IDatatype defaut(IDatatype dt, Query q) {
  5. if (isBoolean()) {
  6. return defaultBooleanResult();
  7. }
  8. int ope = defaut;
  9. if (q != null) {
  10. // Expr exp = q.getProfile(STL_DEFAULT);
  11. Extension ext = q.getExtension();
  12. if (ext != null) {
  13. Expr exp = ext.get(STL_DEFAULT);
  14. if (exp != null) {
  15. ope = exp.getBody().oper(); //getExp(1).oper();
  16. }
  17. }
  18. }
  19. return display(dt, ope);
  20. }

代码示例来源:origin: Wimmics/corese

  1. IDatatype eval(String name, IDatatype dt, IDatatype def, Environment env) {
  2. if (env != null && env.getQuery() != null) {
  3. Query q = env.getQuery();
  4. Extension ext = q.getExtension();
  5. if (ext != null) {
  6. Expr function = ext.get(name, (dt == null) ? 0 : 1);
  7. if (function != null) {
  8. IDatatype dt1 = new Funcall(name).call((Interpreter) exec.getEvaluator(),
  9. (Binding) env.getBind(), env, exec.getProducer(), (Function) function, param(dt));
  10. return dt1;
  11. }
  12. }
  13. }
  14. return def;
  15. }

代码示例来源:origin: fr.inria.corese/corese-core

  1. IDatatype eval(String name, IDatatype dt, IDatatype def, Environment env) {
  2. if (env != null && env.getQuery() != null) {
  3. Query q = env.getQuery();
  4. Extension ext = q.getExtension();
  5. if (ext != null) {
  6. Expr function = ext.get(name, (dt == null) ? 0 : 1);
  7. if (function != null) {
  8. IDatatype dt1 = new Funcall(name).call((Interpreter) exec.getEvaluator(),
  9. (Binding) env.getBind(), env, exec.getProducer(), (Function) function, param(dt));
  10. return dt1;
  11. }
  12. }
  13. }
  14. return def;
  15. }

代码示例来源:origin: fr.inria.corese/corese-core

  1. /**
  2. * Load templates from directory (.rq) or from a file (.rul)
  3. */
  4. void init() {
  5. setOptimize(table.isOptimize(pp));
  6. Loader load = new Loader(this);
  7. load.setDataset(ds);
  8. qe = load.load(getTransformation());
  9. // templates share profile functions
  10. qe.profile();
  11. // templates share table: transformation -> Transformer
  12. complete();
  13. if (isCheck()) {
  14. check();
  15. }
  16. setHasDefault(qe.getTemplate(STL_DEFAULT) != null);
  17. Query profile = qe.getTemplate(STL_PROFILE);
  18. if (profile != null && profile.getExtension() != null) {
  19. Expr exp = profile.getExtension().get(STL_AGGREGATE);
  20. if (exp != null) {
  21. defAggregate = exp.getBody().oper();
  22. }
  23. }
  24. qe.sort();
  25. }

代码示例来源:origin: Wimmics/corese

  1. /**
  2. * Load templates from directory (.rq) or from a file (.rul)
  3. */
  4. void init() {
  5. setOptimize(table.isOptimize(pp));
  6. Loader load = new Loader(this);
  7. load.setDataset(ds);
  8. qe = load.load(getTransformation());
  9. // templates share profile functions
  10. qe.profile();
  11. // templates share table: transformation -> Transformer
  12. complete();
  13. if (isCheck()) {
  14. check();
  15. }
  16. setHasDefault(qe.getTemplate(STL_DEFAULT) != null);
  17. Query profile = qe.getTemplate(STL_PROFILE);
  18. if (profile != null && profile.getExtension() != null) {
  19. Expr exp = profile.getExtension().get(STL_AGGREGATE);
  20. if (exp != null) {
  21. defAggregate = exp.getBody().oper();
  22. }
  23. }
  24. qe.sort();
  25. }

相关文章