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

Examples of org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable


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

    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


    selectQuery.addSelection(variable);
    UriRef defaultGraph = new UriRef("http://example.org/library");
    selectQuery.addDefaultGraph(defaultGraph);
    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);
View Full Code Here

        "<http://www.w3.org/2001/vcard-rdf/3.0#FN> ?name . } " +
        "WHERE { ?x <http://xmlns.com/foaf/0.1/name> ?name . }";

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

    final String queryString = "ASK WHERE { ?x <http://xmlns.com/foaf/0.1/name> " +
        "\"Alice\"^^<http://www.w3.org/2001/XMLSchema#string> . }";

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

    Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
View Full Code Here

        Object arg1 = argument1CSO.getClerezzaObject();
        Object dt = datatypePropertyCSO.getClerezzaObject();
        Object arg2 = argument2CSO.getClerezzaObject();

        UriRefOrVariable subject;
        UriRefOrVariable predicate;
        ResourceOrVariable object;

        if (arg1 instanceof Variable) {
            subject = new UriRefOrVariable((Variable) arg1);
        } else if (arg1 instanceof UriRef) {
            subject = new UriRefOrVariable((UriRef) arg1);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (dt instanceof Variable) {
            predicate = new UriRefOrVariable((Variable) dt);
        } else if (dt instanceof UriRef) {
            predicate = new UriRefOrVariable((UriRef) dt);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (arg2 instanceof Variable) {
            object = new UriRefOrVariable((Variable) arg2);
        } else if (dt instanceof UriRef) {
            object = new UriRefOrVariable((UriRef) arg2);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        return (T) new ClerezzaSparqlObject(new SimpleTriplePattern(subject, predicate, object));
View Full Code Here

        Object arg1 = argument1CSO.getClerezzaObject();
        Object dt = datatypePropertyCSO.getClerezzaObject();
        Object arg2 = argument2CSO.getClerezzaObject();

        UriRefOrVariable subject;
        UriRefOrVariable predicate;
        ResourceOrVariable object;

        if (arg1 instanceof Variable) {
            subject = new UriRefOrVariable((Variable) arg1);
        } else if (arg1 instanceof UriRef) {
            subject = new UriRefOrVariable((UriRef) arg1);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (dt instanceof Variable) {
            predicate = new UriRefOrVariable((Variable) dt);
        } else if (dt instanceof UriRef) {
            predicate = new UriRefOrVariable((UriRef) dt);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (arg2 instanceof Variable) {
View Full Code Here

                                         UnavailableRuleObjectException,
                                         UnsupportedTypeForExportException {

        org.apache.stanbol.rules.manager.atoms.BlankNodeAtom tmp = (org.apache.stanbol.rules.manager.atoms.BlankNodeAtom) ruleAtom;

        UriRefOrVariable subject;
        UriRefOrVariable predicate;
        ResourceOrVariable object;

        IObjectAtom argument2UriResource = tmp.getArgument2();
        IObjectAtom argument1UriResource = tmp.getArgument1();

        ClerezzaSparqlObject subjectCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument2UriResource,
            ConstructQuery.class);
        ClerezzaSparqlObject predicateCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument1UriResource,
            ConstructQuery.class);

        subject = new UriRefOrVariable((UriRef) subjectCSO.getClerezzaObject());
        predicate = new UriRefOrVariable((UriRef) predicateCSO.getClerezzaObject());
        object = new ResourceOrVariable(new BNode());

        return (T) new ClerezzaSparqlObject(new SimpleTriplePattern(subject, predicate, object));

    }
View Full Code Here

        ClerezzaSparqlObject argumentCSO = (ClerezzaSparqlObject) adapter.adaptTo(argument1,
            ConstructQuery.class);
        ClerezzaSparqlObject classCSO = (ClerezzaSparqlObject) adapter.adaptTo(classResource,
            ConstructQuery.class);

        UriRefOrVariable subject;
        UriRefOrVariable predicate = new UriRefOrVariable(RDF.type);
        ResourceOrVariable object;

        Object arg = argumentCSO.getClerezzaObject();
        Object cl = classCSO.getClerezzaObject();

        if (arg instanceof Variable) {
            subject = new UriRefOrVariable((Variable) arg);
        } else if (arg instanceof UriRef) {
            subject = new UriRefOrVariable((UriRef) arg);
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (cl instanceof Variable) {
View Full Code Here

        this.predicate = predicate;
        this.object = object;
    }

    public SimpleTriplePattern(Variable subject, Variable predicate, Variable object) {
        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
                new ResourceOrVariable(object));
    }
View Full Code Here

        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
                new ResourceOrVariable(object));
    }

    public SimpleTriplePattern(NonLiteral subject, Variable predicate, Variable object) {
        this(new ResourceOrVariable(subject), new UriRefOrVariable(predicate),
                new ResourceOrVariable(object));
    }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.sparql.query.UriRefOrVariable

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.