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

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


    ResourceOrVariable s = new ResourceOrVariable(new UriRef(subject));
    UriRefOrVariable p = new UriRefOrVariable(new UriRef(predicate));
    ResourceOrVariable o = new ResourceOrVariable(new Variable(variable));

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(s, p, o)));
  }
View Full Code Here


    BasicGraphPattern bgp = (BasicGraphPattern) gp;

    Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size()==2);

    Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
        new Variable("a"), new Variable("x"),
        new PlainLiteralImpl("tiger"))));

    Assert.assertTrue(triplePatterns.contains(new SimpleTriplePattern(
        new Variable("a"), new Variable("x"),
        new PlainLiteralImpl("lion", new Language("en")))));
  }
View Full Code Here

    ResourceOrVariable s = new ResourceOrVariable(new UriRef(subject1));
    UriRefOrVariable p = new UriRefOrVariable(new UriRef(predicate1));
    ResourceOrVariable o = new ResourceOrVariable(new Variable(variable1));

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(s, p, o)));

    GraphPattern gp = (GraphPattern) constructQuery.getQueryPattern()
        .getGraphPatterns().toArray()[0];
    Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp.getClass()));
    BasicGraphPattern bgp = (BasicGraphPattern) gp;
    triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size()==1);

    s = new ResourceOrVariable(new Variable(variable2));
    p = new UriRefOrVariable(new UriRef(predicate2));

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(s, p, o)));
  }
View Full Code Here

    Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size()==1);

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(new Variable(variable),
        new UriRef(predicate), new PlainLiteralImpl(object))));
  }
View Full Code Here

    ResourceOrVariable s = new ResourceOrVariable(new UriRef(base+subject));
    UriRefOrVariable p = new UriRefOrVariable(new UriRef(prefixUri+predicate));
    ResourceOrVariable o = new ResourceOrVariable(new Variable(variable));

    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(s, p, o)));
  }
View Full Code Here

    BasicGraphPattern bgp = (BasicGraphPattern) ogp.getMainGraphPattern();

    Set<TriplePattern> triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size() == 1);
    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(var1, new UriRef(prefix1Uri + predicate1),
        var2)));

    GraphPattern gp2 = (GraphPattern) ogp.getOptionalGraphPattern()
        .getGraphPatterns().toArray()[0];
    Assert.assertTrue(BasicGraphPattern.class.isAssignableFrom(gp2.getClass()));
    bgp = (BasicGraphPattern) gp2;

    triplePatterns = bgp.getTriplePatterns();
    Assert.assertTrue(triplePatterns.size() == 1);
    Assert.assertTrue(triplePatterns.contains(
        new SimpleTriplePattern(var1, new UriRef(prefix2Uri + predicate2),
        var3)));
  }
View Full Code Here

    ResourceOrVariable subject = new ResourceOrVariable(
        new UriRef("http://example.org/book/book1"));
    UriRefOrVariable predicate = new UriRefOrVariable(
        new UriRef("http://purl.org/dc/elements/1.1/title"));
    ResourceOrVariable object = new ResourceOrVariable(variable);
    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();
View Full Code Here

        new UriRef("http://example.org/person#Alice"));
    UriRefOrVariable p = new UriRefOrVariable(
        new UriRef("http://www.w3.org/2001/vcard-rdf/3.0#FN"));
    ResourceOrVariable o = new ResourceOrVariable(new Variable("name"));
    Set<TriplePattern> constructTriplePatterns = new HashSet<TriplePattern>();
    constructTriplePatterns.add(new SimpleTriplePattern(s, p, o));
    SimpleConstructQuery constructQuery = new SimpleConstructQuery(constructTriplePatterns);

    s = new ResourceOrVariable(new Variable("x"));
    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);
View Full Code Here

        new UriRef("http://xmlns.com/foaf/0.1/name"));
    ResourceOrVariable o = new ResourceOrVariable(
        LiteralFactory.getInstance().createTypedLiteral("Alice"));

    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);
View Full Code Here

    selectQuery.addSelection(title);
    selectQuery.addSelection(price);

    Variable x = new Variable("x");
    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
    triplePatterns.add(new SimpleTriplePattern(x,
        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);
View Full Code Here

TOP

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

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.