Package org.apache.clerezza.rdf.core.sparql.query.impl

Examples of org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGroupGraphPattern


    TriplePattern triplePattern = new SimpleTriplePattern(subject, predicate, object);
    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(triplePattern);

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    selectQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here


    p = new UriRefOrVariable(new UriRef("http://xmlns.com/foaf/0.1/name"));
    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(s, p, o));

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    constructQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(constructQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(s, p, o));
    SimpleAskQuery askQuery = new SimpleAskQuery();

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    askQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(askQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

        new UriRef("http://example.org/ns#price"), price));
    triplePatterns.add(new SimpleTriplePattern(x,
        new UriRef("http://purl.org/dc/elements/1.1/title"), title));

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    BinaryOperation constraint = new BinaryOperation("<",
        price, new LiteralExpression(LiteralFactory.getInstance().createTypedLiteral(30.5)));
    queryPattern.addConstraint(constraint);
    selectQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(resource,
        new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), myType));

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    BinaryOperation constraint = new BinaryOperation("=",
        resource, new UriRefExpression(new UriRef("http://example.org/ontology#special")));
    queryPattern.addConstraint(constraint);
    selectQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

    selectQuery.addSelection(c);

    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(a, b, c));
    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);
    selectQuery.setQueryPattern(queryPattern);
    selectQuery.addOrderCondition(new SimpleOrderCondition(c, false));

    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
View Full Code Here

        new UriRef("http://example.org/ns#price"), price));

    SimpleBasicGraphPattern bgpOpt =
        new SimpleBasicGraphPattern(triplePatternsOpt);

    SimpleGroupGraphPattern ggpOpt = new SimpleGroupGraphPattern();
    ggpOpt.addGraphPattern(bgpOpt);

    SimpleOptionalGraphPattern ogp = new SimpleOptionalGraphPattern(bgp, ggpOpt);

    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(ogp);
    selectQuery.setQueryPattern(queryPattern);

    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(
        new UriRef("http://localhost/testitem"), p, x));

    SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
    SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
    queryPattern.addGraphPattern(bgp);

    List<Expression> arguments = new ArrayList<Expression>();
    arguments.add(x);
    arguments.add(new LiteralExpression(LiteralFactory.getInstance().
        createTypedLiteral(".*uni.*")));
    BuiltInCall constraint = new BuiltInCall("REGEX", arguments);
    queryPattern.addConstraint(constraint);
    selectQuery.setQueryPattern(queryPattern);
    Assert.assertTrue(selectQuery.toString()
        .replaceAll("( |\n)+", " ").trim().equals(queryString));
  }
View Full Code Here

            } else if (clerezzaObj instanceof Expression) {
                expressions.add((Expression) clerezzaObj);
            }
        }

        SimpleGroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern();

        groupGraphPattern.addTriplePatterns(triplePatterns);

        for (Expression expression : expressions) {
            groupGraphPattern.addConstraint(expression);
        }

        triplePatterns = new HashSet<TriplePattern>();
        it = rule.getHead().iterator();
        while (it.hasNext()) {
View Full Code Here

        TriplePattern triplePattern = new SimpleTriplePattern(subject, predicate, object);
        Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
        triplePatterns.add(triplePattern);

        SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
        SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
        queryPattern.addGraphPattern(bgp);
        selectQuery.setQueryPattern(queryPattern);

        Assert.assertTrue(selectQuery.toString()
                .replaceAll("( |\n)+", " ").trim().equals(queryString));
    }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.sparql.query.impl.SimpleGroupGraphPattern

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.