本文整理汇总了Java中de.fuberlin.wiwiss.d2rq.nodes.NodeMaker类的典型用法代码示例。如果您正苦于以下问题:Java NodeMaker类的具体用法?Java NodeMaker怎么用?Java NodeMaker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeMaker类属于de.fuberlin.wiwiss.d2rq.nodes包,在下文中一共展示了NodeMaker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extendWith
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
/**
* Joins this NodeRelation with a Binding. Any row in this
* NodeRelation that is incompatible with the binding will be
* dropped, and any compatible row will be extended with
* FixedNodeMakers whose node is taken from the binding.
*
* @param binding A binding to join with this NodeRelation
* @return The joined NodeRelation
*/
public NodeRelation extendWith(Binding binding) {
if (binding.isEmpty()) return this;
MutableRelation mutator = new MutableRelation(baseRelation());
Map<Var,NodeMaker> columns = new HashMap<Var,NodeMaker>();
for (Var variable: variables()) {
columns.put(variable, nodeMaker(variable));
}
for (Iterator<Var> it = binding.vars(); it.hasNext();) {
Var var = it.next();
Node value = binding.get(var);
if (columns.containsKey(var)) {
columns.put(var, columns.get(var).selectNode(value, mutator));
} else {
columns.put(var, new FixedNodeMaker(value, false));
}
}
return new NodeRelation(mutator.immutableSnapshot(), columns);
}
示例2: selectTriple
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public TripleRelation selectTriple(Triple t) {
MutableRelation newBase = new MutableRelation(baseRelation());
NodeMaker s = nodeMaker(SUBJECT).selectNode(t.getSubject(), newBase);
if (s.equals(NodeMaker.EMPTY)) return null;
NodeMaker p = nodeMaker(PREDICATE).selectNode(t.getPredicate(), newBase);
if (p.equals(NodeMaker.EMPTY)) return null;
NodeMaker o = nodeMaker(OBJECT).selectNode(t.getObject(), newBase);
if (o.equals(NodeMaker.EMPTY)) return null;
Set<ProjectionSpec> projections = new HashSet<ProjectionSpec>();
projections.addAll(s.projectionSpecs());
projections.addAll(p.projectionSpecs());
projections.addAll(o.projectionSpecs());
newBase.project(projections);
if (!s.projectionSpecs().isEmpty() && o.projectionSpecs().isEmpty()) {
newBase.swapLimits();
}
return new TripleRelation(newBase.immutableSnapshot(), s, p, o);
}
示例3: convertIsIRI
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private void convertIsIRI(E_IsIRI expr)
{
logger.debug("convertIsIRI " + expr.toString());
expr.getArg().visit(this);
Expression arg = expression.pop();
if (arg instanceof AttributeExprEx) {
AttributeExprEx variable = (AttributeExprEx) arg;
NodeMaker nm = variable.getNodeMaker();
DetermineNodeType filter = new DetermineNodeType();
nm.describeSelf(filter);
expression.push(filter.isLimittedToURIs() ? Expression.TRUE : Expression.FALSE);
} else if (arg instanceof ConstantEx) {
ConstantEx constant = (ConstantEx) arg;
Node node = constant.getNode();
expression.push(node.isURI() ? Expression.TRUE : Expression.FALSE);
} else {
conversionFailed(expr);
}
}
示例4: convertIsBlank
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private void convertIsBlank(E_IsBlank expr)
{
logger.debug("convertIsBlank " + expr.toString());
expr.getArg().visit(this);
Expression arg = expression.pop();
if (arg instanceof AttributeExprEx) {
AttributeExprEx variable = (AttributeExprEx) arg;
NodeMaker nm = variable.getNodeMaker();
DetermineNodeType filter = new DetermineNodeType();
nm.describeSelf(filter);
expression.push(filter.isLimittedToBlankNodes() ? Expression.TRUE : Expression.FALSE);
} else if (arg instanceof ConstantEx) {
ConstantEx constant = (ConstantEx) arg;
Node node = constant.getNode();
expression.push(node.isBlank() ? Expression.TRUE : Expression.FALSE);
} else {
conversionFailed(expr);
}
}
示例5: convertIsLiteral
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private void convertIsLiteral(E_IsLiteral expr)
{
logger.debug("convertIsLiteral " + expr.toString());
expr.getArg().visit(this);
Expression arg = expression.pop();
logger.debug("arg " + arg);
if (arg instanceof AttributeExprEx) {
AttributeExprEx variable = (AttributeExprEx) arg;
NodeMaker nm = variable.getNodeMaker();
DetermineNodeType filter = new DetermineNodeType();
nm.describeSelf(filter);
expression.push(filter.isLimittedToLiterals() ? Expression.TRUE : Expression.FALSE);
} else if (arg instanceof ConstantEx) {
ConstantEx constant = (ConstantEx) arg;
Node node = constant.getNode();
expression.push(node.isLiteral() ? Expression.TRUE : Expression.FALSE);
} else {
conversionFailed(expr);
}
}
示例6: buildNodeMaker
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private NodeMaker buildNodeMaker() {
if (this.constantValue != null) {
return new FixedNodeMaker(this.constantValue.asNode(),
!this.containsDuplicates);
}
if (this.refersToClassMap == null) {
return buildNodeMaker(wrapValueSource(buildValueSourceBase()), !this.containsDuplicates);
}
return this.refersToClassMap.buildAliasedNodeMaker(new AliasMap(aliases()), !this.containsDuplicates);
}
示例7: createFor
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public static BindingMaker createFor(NodeRelation relation) {
Map<Var, NodeMaker> vars = new HashMap<Var,NodeMaker>();
for (Var variable: relation.variables()) {
vars.put(variable, relation.nodeMaker(variable));
}
return new BindingMaker(vars, null);
}
示例8: createFrom
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
static AttributeSet createFrom(NodeMaker nodeMaker)
{
AttributeSet attributes = new AttributeSet();
Set<ProjectionSpec> projectionSpecs = nodeMaker.projectionSpecs();
boolean err = projectionSpecs.isEmpty();
Iterator<ProjectionSpec> projectionIterator = projectionSpecs.iterator();
while (projectionIterator.hasNext() && !err) {
ProjectionSpec projection = (ProjectionSpec) projectionIterator.next();
Set<Attribute> reqAttr = projection.requiredAttributes();
Iterator<Attribute> j = reqAttr.iterator();
while (j.hasNext() && !err) {
Attribute a = (Attribute) j.next();
if (attributes.relationName == null)
attributes.relationName = a.relationName();
else if (!attributes.relationName.equals(a.relationName()))
err = true;
attributes.attributeNames.add(a.attributeName());
}
// if (projection instanceof Attribute) {
// Attribute a = (Attribute) projection;
// if (attributes.relationName == null)
// attributes.relationName = a.relationName();
// else if (!attributes.relationName.equals(a.relationName()))
// err = true;
//
// attributes.attributeNames.add(a.attributeName());
// } else {
// err = true;
// }
}
if (!err)
return attributes;
return null;
}
示例9: getRelationNames
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private List<RelationName> getRelationNames(NodeMaker nodeMaker)
{
List<RelationName> result = new ArrayList<RelationName>();
Set<ProjectionSpec> projectionSpecs = nodeMaker.projectionSpecs();
for (ProjectionSpec spec: projectionSpecs) {
for (Attribute a: spec.requiredAttributes()) {
result.add(a.relationName());
}
}
return result;
}
示例10: add
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public void add(Var var, NodeMaker nodeMaker, AliasMap aliases) {
if (!nodeMakers.containsKey(var)) {
nodeMakers.put(var, nodeMaker);
projections.addAll(nodeMaker.projectionSpecs());
}
if (!nodeSets.containsKey(var)) {
nodeSets.put(var, new NodeSetConstraintBuilder());
}
NodeSetFilter nodeSet = nodeSets.get(var);
nodeMaker.describeSelf(nodeSet);
if (!nodeRelationAliases.containsKey(var)) {
nodeRelationAliases.put(var, aliases);
}
}
示例11: empty
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public static NodeRelation empty(Set<Var> variables) {
Map<Var,NodeMaker> map = new HashMap<Var,NodeMaker>();
for (Var variable: variables) {
map.put(variable, NodeMaker.EMPTY);
}
return new NodeRelation(Relation.EMPTY, map);
}
示例12: withPrefix
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public NodeRelation withPrefix(int index) {
Collection<Alias> newAliases = new ArrayList<Alias>();
for (RelationName tableName: baseRelation().tables()) {
newAliases.add(new Alias(tableName, tableName.withPrefix(index)));
}
AliasMap renamer = new AliasMap(newAliases);
Map<Var,NodeMaker> renamedNodeMakers = new HashMap<Var,NodeMaker>();
for (Var variable: variables()) {
renamedNodeMakers.put(variable, nodeMaker(variable).renameAttributes(renamer));
}
return new NodeRelation(baseRelation().renameColumns(renamer), renamedNodeMakers);
}
示例13: renameSingleRelation
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public NodeRelation renameSingleRelation(RelationName oldName, RelationName newName) {
AliasMap renamer = AliasMap.create1(oldName, newName);
Map<Var,NodeMaker> renamedNodeMakers = new HashMap<Var,NodeMaker>();
// This is only done for consistency as the NodeMakers won't be used
for (Var variable: variables()) {
renamedNodeMakers.put(variable, nodeMaker(variable).renameAttributes(renamer));
}
return new NodeRelation(baseRelation().renameColumns(renamer), renamedNodeMakers);
}
示例14: TripleRelation
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
public TripleRelation(Relation baseRelation,
final NodeMaker subjectMaker, final NodeMaker predicateMaker, final NodeMaker objectMaker) {
super(baseRelation, new HashMap<Var,NodeMaker>() {{
put(SUBJECT, subjectMaker);
put(PREDICATE, predicateMaker);
put(OBJECT, objectMaker);
}});
}
示例15: uriMakerIdentifier
import de.fuberlin.wiwiss.d2rq.nodes.NodeMaker; //导入依赖的package包/类
private URIMakerIdentifier uriMakerIdentifier(NodeMaker nodeMaker) {
URIMakerIdentifier cachedIdentifier = (URIMakerIdentifier) this.identifierCache.get(nodeMaker);
if (cachedIdentifier == null) {
cachedIdentifier = new URIMakerIdentifier(nodeMaker);
this.identifierCache.put(nodeMaker, cachedIdentifier);
}
return cachedIdentifier;
}