Package de.timefinder.algo.graph

Examples of de.timefinder.algo.graph.SimpleTree$SimpleNode


            // can change while the search. This is the reason for this separate
            // search. Now we construct the path.

            // The following tree contains only the y nodes!
            // The corresponding x node can simply be retrieved from the matching.
            SimpleTree augmentatingTree = new SimpleTree();
            Set<Integer> yNeighbors = eqSubGraph.getX(u);
            augmentatingTree.setRoots(yNeighbors);
            int tmpX;

            // TODO do we need setS or setT here?
            while (!yNeighbors.contains(y)) {
                for (int tmpY : yNeighbors) {
                    if (matching.getY(tmpY).size() > 0) {
                        tmpX = matching.getY(tmpY).iterator().next();
                        augmentatingTree.addBranches(tmpY, eqSubGraph.getX(tmpX));
                    }
                }

                augmentatingTree.higher();
                yNeighbors = augmentatingTree.getNeighbors();
            }

            // ... and swap the matching along the this path
            // => extended matching (one more edge).
            boolean ret;
            int currentX, currentY;
            int lastY = y;
            Iterator<Integer> augmentingIter = augmentatingTree.getToRootIterator(y);

            while (augmentingIter.hasNext()) {
                currentY = augmentingIter.next();
                Set<Integer> matchedX = matching.getY(currentY);
                assert matchedX.size() == 1;
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

    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

TOP

Related Classes of de.timefinder.algo.graph.SimpleTree$SimpleNode

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.