本文整理汇总了Java中com.hp.hpl.jena.sparql.core.BasicPattern.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java BasicPattern.addAll方法的具体用法?Java BasicPattern.addAll怎么用?Java BasicPattern.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.sparql.core.BasicPattern
的用法示例。
在下文中一共展示了BasicPattern.addAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeToBGP
import com.hp.hpl.jena.sparql.core.BasicPattern; //导入方法依赖的package包/类
private Op mergeToBGP(Op left, Op right) {
BasicPattern bgp = new BasicPattern();
if (OpBGP.isBGP(left)) {
bgp.addAll(((OpBGP) left).getPattern());
} else {
if (!(left instanceof OpTable))
Log.warn(this, "mergeToBGP left not valid BGP " + left.toString());
}
if (OpBGP.isBGP(right)) {
bgp.addAll(((OpBGP) right).getPattern());
;
} else {
if (!(right instanceof OpTable))
Log.warn(this, "mergeToBGP right not valid BGP"+ right.toString());
}
return new OpBGP(bgp);
}
示例2: transformPathToBasicPattern
import com.hp.hpl.jena.sparql.core.BasicPattern; //导入方法依赖的package包/类
public static BasicPattern transformPathToBasicPattern(Node subject, String sPath, Node object){
BasicPattern res= new BasicPattern();
boolean inverse = checkInverse(sPath);
if (inverse)
{
sPath = sPath.substring(1);
Node temp = subject;
subject = object;
object = temp;
}
sPath = TransformerHelper.removeScopes(sPath);
int operatorPos = TransformerHelper.getPosOfNextOperator(sPath);
if (operatorPos < 0)
{
Triple triple = new Triple(subject, NodeFactory.createURI(sPath.substring(1, sPath.length()-1)), object);
res.add(triple);
return res;
}
String leftStringPath = sPath.substring(0, operatorPos);
String rightStringPath = sPath.substring(operatorPos+1);
Node newConection = NodeFactory.createVariable(getNextVaribleName());
BasicPattern leftPattern = transformPathToBasicPattern(subject, leftStringPath, newConection);
BasicPattern rightPattern = transformPathToBasicPattern(newConection, rightStringPath, object);
res.addAll(leftPattern);
res.addAll(rightPattern);
return res;
}