use of fr.lirmm.graphik.graal.core.DefaultRule in project graal by graphik-team.
the class DefaultRuleFactory method create.
@Override
public Rule create(Atom[] body, Atom[] head) {
InMemoryAtomSet bodySet = DefaultAtomSetFactory.instance().create(body);
InMemoryAtomSet headSet = DefaultAtomSetFactory.instance().create(head);
return new DefaultRule(bodySet, headSet);
}
use of fr.lirmm.graphik.graal.core.DefaultRule in project graal by graphik-team.
the class DefaultRuleFactory method create.
@Override
public Rule create(Atom body, Atom head) {
InMemoryAtomSet bodySet = DefaultAtomSetFactory.instance().create(body);
InMemoryAtomSet headSet = DefaultAtomSetFactory.instance().create(head);
return new DefaultRule(bodySet, headSet);
}
use of fr.lirmm.graphik.graal.core.DefaultRule in project graal by graphik-team.
the class SparqlRuleParser method execute.
// /////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS
// /////////////////////////////////////////////////////////////////////////
private void execute(String sparqlQuery) {
Query sparql = QueryFactory.create(sparqlQuery);
this.prefixes = new LinkedList<Prefix>();
for (Map.Entry<String, String> e : sparql.getPrefixMapping().getNsPrefixMap().entrySet()) {
this.prefixes.add(new Prefix(e.getKey(), e.getValue()));
}
Rule rule = new DefaultRule();
if (sparql.isConstructType()) {
Template template = sparql.getConstructTemplate();
for (Triple triple : template.getTriples()) {
rule.getHead().add(SparqlUtils.triple2Atom(triple));
}
}
ElementVisitorImpl visitor = new ElementVisitorImpl(rule.getBody());
sparql.getQueryPattern().visit(visitor);
this.rule = rule;
}
Aggregations