Package lupos.sparql1_1

Examples of lupos.sparql1_1.ASTFilterConstraint


  public void handleParseError(Throwable t) throws ModificationException {
    int line = 0;
    int column = 0;

    if(t instanceof ParseException) {
      ParseException pe = (ParseException) t;

      // get precise line and column...
      if(pe.currentToken.next == null) {
        line = pe.currentToken.beginLine;
        column = pe.currentToken.beginColumn;
View Full Code Here


  private static TYPE__SemanticWeb[] TOKEN_MAP;
  private final SPARQL1_1Parser parser;

  private SPARQLParser(final LuposDocumentReader reader){
    this.parser = new SPARQL1_1Parser(reader);
  }
View Full Code Here

    this.items = items;
  }

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

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

  private static String determineNewQuery(final String oldQuery,
      final SPARQLParserVisitorImplementationDumper spvid) {
    try {
      // get root node...
      final SimpleNode root = SPARQL1_1Parser.parse(oldQuery);
      return (String) spvid.visit(root);
    } catch (final ParseException e) {
      System.out.println(e);
      e.printStackTrace();
    }
View Full Code Here

  }

  private static String determineNewQueryProjectionWithoutVariable(
      final String oldQuery, final Variable v) {
    try {
      final SimpleNode root = SPARQL1_1Parser.parse(oldQuery);
      return determineNewQuery(oldQuery,
          new SPARQLParserVisitorImplementationDumper() {
        @Override
        public String visit(final ASTSelectQuery node) {
          String ret = "SELECT ";
View Full Code Here

    });
  }

  private String refineQuery(final String oldQuery, final Variable toBeRefined) {
    try {
      final SimpleNode root = SPARQL1_1Parser.parse(oldQuery);
      final HashSet<String> variables = new HashSet<String>();
      determineVariables(root, variables);
      String varSO = "SO";
      while (variables.contains(varSO))
        varSO += "a";
View Full Code Here

    });
  }

  private static HashSet<String> determineVariables(final String query) {
    try {
      final SimpleNode root = SPARQL1_1Parser.parse(query);
      final HashSet<String> variables = new HashSet<String>();
      determineVariables(root, variables);
      return variables;
    } catch (final ParseException e) {
      System.out.println(e);
View Full Code Here

  private static String determineNewQueryRenamedVariable(
      final String currentBrowserQuery, final Variable toBeRenamed,
      String newName) {
    try {
      final SimpleNode root = SPARQL1_1Parser.parse(currentBrowserQuery);

      try {
        SPARQL1_1Parser.parseVar(newName);
      } catch (final Throwable e) {
        try {
View Full Code Here

  }

  @Override
  public long compileQuery(final String query) throws ParseException {
    final Date a = new Date();
    SimpleNode root = StreamSPARQL1_1Parser.parse(query);
    try {
      final SPARQL2CoreSPARQLParserVisitorImplementationDumper spvid = SPARQL2CoreSPARQLParserVisitorImplementationDumper.createInstance();
      final String corequery = (root==null)?"":(String) spvid.visit(root);
      root = StreamSPARQL1_1Parser.parse(corequery);
      // checkForTimeFunc(root);
View Full Code Here

  }

  @Override
  public DebugContainerQuery<BasicOperatorByteArray, Node> compileQueryDebugByteArray(
      final String query, final Prefix prefixInstance) throws ParseException {
    final SimpleNode root = StreamSPARQL1_1Parser.parse(query);
    if(root!=null){
      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);
          }
        }
      }
    }

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

      final SimpleNode rootCoreSPARQL = StreamSPARQL1_1Parser.parse(corequery);

      // checkForTimeFunc(rootCoreSPARQL);

      final StreamOperatorGraphGenerator spvi = StreamOperatorGraphGenerator.createOperatorGraphGenerator(this);
      spvi.visit((ASTQuery)rootCoreSPARQL);
View Full Code Here

TOP

Related Classes of lupos.sparql1_1.ASTFilterConstraint

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.