Package lupos.sparql1_1

Examples of lupos.sparql1_1.ASTSelectQuery


    this.rootNode = root_param;
    if (this.rdfs == RDFS.OPTIMIZEDRDFS || this.rdfs == RDFS.OPTIMIZEDRUDIMENTARYRDFS
        || this.rdfs == RDFS.OPTIMIZEDALTERNATIVERDFS) {
      this.rdfsStreamQueryToIndexQuery(query, root_param);
    } else {
      SimpleNode root = SPARQL1_1Parser.parse(query);

      final SPARQL2CoreSPARQLParserVisitorImplementationDumper spvid = SPARQL2CoreSPARQLParserVisitorImplementationDumper.createInstance();
      final String corequery = (root==null)?"":(String) spvid.visit(root);

      root = SPARQL1_1Parser.parse(corequery);
View Full Code Here


    final DebugContainerQuery<BasicOperatorByteArray, Node> dcq;
    if (this.rdfs == RDFS.OPTIMIZEDRDFS || this.rdfs == RDFS.OPTIMIZEDRUDIMENTARYRDFS || this.rdfs == RDFS.OPTIMIZEDALTERNATIVERDFS) {
      dcq = this.rdfsStreamQueryToIndexQueryDebugByteArray(query, root_param, prefixInstance);
    } else {
      final SimpleNode root = SPARQL1_1Parser.parse(query);

      for (int i = 0; i < root.jjtGetNumChildren(); ++i) {
        final Node child = root.jjtGetChild(i); // get current child

        if (child instanceof ASTPrefixDecl) {
          // get prefix...
          final String prefix = ((ASTPrefixDecl) child).getPrefix();

          // get child of PrefixDecl to get the namespace...
          final Node prefixDeclChild = child.jjtGetChild(0);

          // if child of PrefixDecl is QuotedURIRef...
          if (prefixDeclChild instanceof ASTQuotedURIRef) {
            // get namespace...
            final String namespace = ((ASTQuotedURIRef) prefixDeclChild)
            .toQueryString();

            // add namespace and prefix to predefined list
            // of prefix instance...
            prefixInstance.getPredefinedList().put(namespace,
                prefix);
          }
        }
      }

      final SPARQL2CoreSPARQLParserVisitorImplementationDumper spvid = SPARQL2CoreSPARQLParserVisitorImplementationDumper.createInstance();

      final String corequery = (root==null)?"":(String) spvid.visit(root);

      final SimpleNode root_CoreSPARQL = SPARQL1_1Parser.parse(corequery);

      if(root_CoreSPARQL==null){
        this.result = new Result();
        root_param.setSucceedingOperator(new OperatorIDTuple(this.result,0));
      } else {
View Full Code Here

    visited.add(this);

    try {
      HashSet<Variable> variables = new HashSet<Variable>();

      SimpleNode node = SPARQL1_1Parser.parseFilter("FILTER(" + this.filterExpression + ")", this.prefix.getPrefixNames());

      Operator.computeUsedVariables(node, variables);

      if(variables.contains(new Variable(variable)))
        return true;
View Full Code Here

    this.item = item;
  }

  public void addPredicate(RDFTerm child, String predicate) throws ModificationException {
    try {
      SimpleNode node = SPARQL1_1Parser.parseVerb(predicate, this.prefix.getPrefixNames());

      this.addPredicate(child, this.getItem(node));
    }
    catch(Throwable t) {
      this.handleParseError(t);
View Full Code Here

      if(this.predicates.get(child).size() == index) {
        this.predicates.get(child).add(null);
      }

      // parse new value...
      SimpleNode node = SPARQL1_1Parser.parseVerb(predicate, this.prefix.getPrefixNames());

      // remove old value...
      if(this.predicates.get(child).get(index) != null) {
        this.predicates.get(child).remove(index);
      }
View Full Code Here

    }
  }

  public void applyChange(String value) throws ModificationException {
    try {
      SimpleNode node = SPARQL1_1Parser.parseRDFTerm(value, this.prefix.getPrefixNames());

      this.item = this.getItem(node);
    }
    catch(Throwable t) {
      this.handleParseError(t);
View Full Code Here

  protected abstract SimpleNode parseProjectionElement(String projectionElement) throws Throwable;

  public void addProjectionElement(String projectionElement) throws ModificationException {
    try {
      SimpleNode node = this.parseProjectionElement(projectionElement);

      if(node instanceof ASTVar) {
        this.projectionElements.add(((ASTVar) node).toQueryString());
      }
      else if(node instanceof ASTQuotedURIRef) {
View Full Code Here

      if(this.projectionElements.size() == index) {
        this.projectionElements.add("");
      }

      // parse new value
      SimpleNode node = this.parseProjectionElement(projectionElement);

      // remove old value...
      if(this.projectionElements.get(index) != null) {
        this.projectionElements.remove(index);
      }
View Full Code Here

    return this.panel;
  }

  public void applyChange(String value) throws ModificationException {
    try {
      SimpleNode node = SPARQL1_1Parser.parseVarOrBlankNodeOrIRIref(value, this.prefix.getPrefixNames());

      this.graphItem = this.getItem(node);
    }
    catch(Throwable t) {
      this.handleParseError(t);
View Full Code Here

  }

  private Operator parseQuery(final String query) throws Throwable {
    this.statusBar.setText("Parsing query ...");

    SimpleNode root = SPARQL1_1Parser.parse(query); // get root node...

    ((VisualGraphOperatorWithPrefix) this.visualGraphs.get(0)).prefix
    .registerElementsInPrefixInstance(root);

    // get coreSPARQL query...
    final boolean[] rules = { true, true, true, true, true, true, true,
        true, true, true, true, true, true, true, false , true, true, true};

    final SPARQL2CoreSPARQLParserVisitorImplementationDumper spvid = SPARQL2CoreSPARQLParserVisitorImplementationDumper.createInstance(rules);
    final String corequery = spvid.visit(root);

    // get root node of coreSPARQL query...
    root = SPARQL1_1Parser.parse(corequery);

    // generate VisualQuery and get root element of it...
    final VisualQueryGenerator vqg = new VisualQueryGenerator(
        ((VisualGraphOperatorWithPrefix) this.visualGraphs.get(0)).prefix);

    final Operator rootNode = (Operator) root.jjtAccept(
        (SPARQL1_1ParserVisitor) vqg, null);
    rootNode.setParents();

    this.statusBar.clear();
View Full Code Here

TOP

Related Classes of lupos.sparql1_1.ASTSelectQuery

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.