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

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


        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

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.