本文整理汇总了Java中com.hp.hpl.jena.sparql.expr.ExprFunction类的典型用法代码示例。如果您正苦于以下问题:Java ExprFunction类的具体用法?Java ExprFunction怎么用?Java ExprFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExprFunction类属于com.hp.hpl.jena.sparql.expr包,在下文中一共展示了ExprFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitExprFunction
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Override
public void visitExprFunction(ExprFunction func) {
if (topDown) {
func.visit(visitor);
}
for (int i = 1; i <= func.numArgs(); i++) {
final Expr expr = func.getArg(i);
if (expr == null) {
break;
}
expr.visit(this);
}
if (!topDown) {
func.visit(visitor);
}
}
开发者ID:aschaetzle,项目名称:S2X,代码行数:17,代码来源:ExprWalker.java
示例2: visit
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
public void visit(ExprFunction func) {
if (func instanceof ExprFunction0) {
visit((ExprFunction0) func);
}
else if (func instanceof ExprFunction1) {
visit((ExprFunction1) func);
}
else if (func instanceof ExprFunction2) {
visit((ExprFunction2) func);
}
else if (func instanceof ExprFunction3) {
visit((ExprFunction3) func);
}
else if (func instanceof ExprFunctionN) {
visit((ExprFunctionN) func);
}
else if (func instanceof ExprFunctionOp) {
visit((ExprFunctionOp) func);
}
}
开发者ID:aschaetzle,项目名称:S2RDF,代码行数:21,代码来源:ExprTranslator.java
示例3: visit
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
public void visit(ExprFunction func) {
if (func instanceof ExprFunction0) {
visit((ExprFunction0) func);
}
else if (func instanceof ExprFunction1) {
visit((ExprFunction1) func);
}
else if (func instanceof ExprFunction2) {
visit((ExprFunction2) func);
}
else if (func instanceof ExprFunction3) {
visit((ExprFunction3) func);
}
else if (func instanceof ExprFunctionN) {
visit((ExprFunctionN) func);
}
else if (func instanceof ExprFunctionOp) {
visit((ExprFunctionOp) func);
}
}
开发者ID:aschaetzle,项目名称:Sempala,代码行数:21,代码来源:ExprTranslator.java
示例4: visitExprFunction
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
private void visitExprFunction(ExprFunction function)
{
logger.debug("visit ExprFunction " + function);
if (!convertable) {
expression.push(Expression.FALSE); // prevent stack empty exceptions when conversion
return; // fails in the middle of a multi-arg operator conversion
}
if (!extensionSupports(function)) {
conversionFailed(function);
return;
}
for (int i = 0; i < function.numArgs(); i++)
function.getArg(i + 1).visit(this);
List<Expression> args = new ArrayList<Expression>(function.numArgs());
for (int i = 0; i < function.numArgs(); i++)
args.add(expression.pop());
Collections.reverse(args);
extensionConvert(function, args);
}
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:23,代码来源:TransformExprToSQLApplyer.java
示例5: testParseTemplate01
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate01() {
String templateStr = "only constant";
E_StrConcatPermissive res = RRUtils.parseTemplate(templateStr);
// should be (E_StrConcatPermissive) concat("only constant")
int expctdNumArgs = 1;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdArg = (new StringBuilder()).append("\"")
.append(templateStr).append("\"").toString();
assertEquals(expctdArg, fnArgs.get(0).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:19,代码来源:RRUtilsTest.java
示例6: testParseTemplate02
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate02() {
String varName1 = "var1";
String tmpltStr = (new StringBuilder()).append("{").append(varName1).append("}").toString();
E_StrConcatPermissive res = RRUtils.parseTemplate(tmpltStr);
// should be (E_StrConcatPermissive) concat(?ar1)
int expctdNumArgs = 1;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdArg = (new StringBuilder()).append("?").append(varName1).toString();
assertEquals(expctdArg, fnArgs.get(0).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:19,代码来源:RRUtilsTest.java
示例7: testParseTemplate03
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate03() {
String varStr1 = "var1";
String constStr1 = "constant1";
String tmpltStr = (new StringBuilder()).append(constStr1).append(" {")
.append(varStr1).append("}").toString();
E_StrConcatPermissive res = RRUtils.parseTemplate(tmpltStr);
// should be (E_StrConcatPermissive) concat("constant1 ", ?var1)
int expctdNumArgs = 2;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdFnArg1Str = (new StringBuilder()).append("\"")
.append(constStr1).append(" \"").toString();
assertEquals(expctdFnArg1Str, fnArgs.get(0).toString());
String expctdFnArg2Str = (new StringBuilder()).append("?").append(varStr1).toString();
assertEquals(expctdFnArg2Str, fnArgs.get(1).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:25,代码来源:RRUtilsTest.java
示例8: testParseTemplate04
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate04() {
String varStr1 = "var1";
String constStr1 = "constant1";
String tmpltStr = (new StringBuilder()).append("{").append(varStr1)
.append("} ").append(constStr1).toString();
E_StrConcatPermissive res = RRUtils.parseTemplate(tmpltStr);
// should be (E_StrConcatPermissive) concat(?var1, " constant1")
int expctdNumArgs = 2;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdFnArg1Str = (new StringBuilder()).append("?")
.append(varStr1).toString();
assertEquals(expctdFnArg1Str, fnArgs.get(0).toString());
String expctdFnArg2Str = (new StringBuilder()).append("\" ")
.append(constStr1).append("\"").toString();
assertEquals(expctdFnArg2Str, fnArgs.get(1).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:26,代码来源:RRUtilsTest.java
示例9: readTcsInfo
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
private void readTcsInfo(Collection<RestrictedExpr> termConstructors, Quad quad, ViewDefinition viewDef) {
// dummy loop since there is always just one term constructor
// a.k.a RestrictedExpr
for (RestrictedExpr tc : termConstructors) {
Expr expr = tc.getExpr();
// skip plainLiteral and typedLiteral term constructors
ExprFunction func = expr.getFunction();
// -1 = var, 0 = bNode, 1 = uri, 2 = plainLiteral, 3 = typedLiteral
double type = func.getArg(1).getConstant().getDouble();
if (type < 2) {
// get term constructor string serialization
String tcString = expr.toString();
// get the names of the referenced colunms
List<String> colNames = new ArrayList<String>();
Set<Var> varsMentioned = expr.getVarsMentioned();
// if there are no, skip to avoid reporting constants
if (varsMentioned.isEmpty()) continue;
// normalize term constructor string (remove concrete variable
// names with placeholders)
for (Var colVar : varsMentioned) {
String colVarName = colVar.getVarName().toLowerCase();
colNames.add(colVarName);
tcString = tcString.replaceAll("\\?" + colVarName, "VAR");
}
String relationName =
getTableKey(colNames, viewDef.getMapping().getSqlOp());
Pair<Quad, ViewDefinition> quadViewDef =
new Pair<Quad, ViewDefinition>(quad, viewDef);
addToTcMap(tcString, relationName, quadViewDef);
}
}
}
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:41,代码来源:NoAmbiguousMappings.java
示例10: buildMapObjStr
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
private void buildMapObjStr(StringBuilder exprStr, Expr expr) {
if (expr.isConstant() && (!expr.getConstant().isString() ||
!expr.getConstant().getString().isEmpty())) {
NodeValue constant = expr.getConstant();
if (constant.isIRI() || constant.isLiteral()) {
// strip off leading and trailing angle brackets or quotes
String nodeStr = constant.toString();
int strLen = nodeStr.length();
exprStr.append(nodeStr.substring(1, strLen-1));
} else {
exprStr.append(expr.getConstant().toString());
}
} else if (expr.isFunction()) {
ExprFunction func = expr.getFunction();
List<Expr> funcArgs = func.getArgs();
for (Expr arg : funcArgs) {
buildMapObjStr(exprStr, arg);
}
} else if (expr.isVariable()) {
String varName = expr.asVar().getName();
exprStr.append("{");
exprStr.append(varName);
exprStr.append("}");
}
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:28,代码来源:TermConstructorConverter.java
示例11: testParseTemplate05
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate05() {
String varStr1 = "var1";
String constStr1 = "constant1";
String constStr2 = "constant2";
String tmpltStr = (new StringBuilder()).append(constStr1).append(" {")
.append(varStr1).append("} ").append(constStr2).toString();
E_StrConcatPermissive res = RRUtils.parseTemplate(tmpltStr);
// should be (E_StrConcatPermissive) concat("constant1 ", ?var1, " constant2")
int expctdNumArgs = 3;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdFnArg1Str = (new StringBuilder()).append("\"")
.append(constStr1).append(" \"").toString();
assertEquals(expctdFnArg1Str, fnArgs.get(0).toString());
String expctdFnArg2Str = (new StringBuilder()).append("?")
.append(varStr1).toString();
assertEquals(expctdFnArg2Str, fnArgs.get(1).toString());
String expctdFnArg3Str = (new StringBuilder()).append("\" ")
.append(constStr2).append("\"").toString();
assertEquals(expctdFnArg3Str, fnArgs.get(2).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:31,代码来源:RRUtilsTest.java
示例12: extensionSupports
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
protected boolean extensionSupports(ExprFunction function)
{
return false;
}
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:5,代码来源:TransformExprToSQLApplyer.java
示例13: extensionConvert
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
protected void extensionConvert(ExprFunction function, List<Expression> args)
{
}
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:4,代码来源:TransformExprToSQLApplyer.java
示例14: buildTermConstructor
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
protected static Expr buildTermConstructor(TermMap termMap) {
Expr inner = null;
ExprFunction outer = null;
if (termMap.isTemplateTermMap()) {
String templateString = termMap.getTemplateTerm().getLexicalForm();
inner = RRUtils.parseTemplate(templateString);
} else if (termMap.isColumnTermMap()) {
inner = NodeValue.makeString("?" + termMap.getColumnTerm());
}
// URI term constructor
if (termMap.getTermType().equals(RR.IRI)) {
outer = new E_URI(inner);
// bNode term constructor
} else if (termMap.getTermType().equals(RR.BlankNode)) {
outer = new E_BNode(inner);
// plainLiteral / typedLiteral term constructor
} else if (termMap.getTermType().equals(RR.Literal)) {
// plain literal with language tag
if (termMap.hasLanguage()) {
// FIXME: what about variable language tags???
E_Lang lang = new E_Lang(NodeValue.makeString(termMap
.getLanguage().getLexicalForm()));
outer = new E_StrLang(inner, lang);
// typed literal
} else if (termMap.hasDatatype()) {
// FIXME: what about variable datatypes???
E_Datatype type = new E_Datatype(
NodeValue.makeString(termMap.getDatatype().getURI()));
outer = new E_StrDatatype(inner, type);
// plain literal wo language tag
} else {
outer = new E_Str(inner);
}
}
return outer;
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:43,代码来源:R2RML2SMLConverter.java
示例15: testParseTemplate06
import com.hp.hpl.jena.sparql.expr.ExprFunction; //导入依赖的package包/类
@Test
public void testParseTemplate06() {
String varStr1 = "var1";
String varStr2 = "var2";
String constStr1 = "constant1";
String constStr2 = "constant2";
String constStr3 = "constant3";
String tmpltStr = (new StringBuilder()).append(constStr1).append(" {")
.append(varStr1).append("} ").append(constStr2).append(" {")
.append(varStr2).append("} ").append(constStr3).toString();
E_StrConcatPermissive res = RRUtils.parseTemplate(tmpltStr);
// should be (E_StrConcatPermissive) concat("constant1 ", ?var1, " constant2 ", ?var2, " constant3")
int expctdNumArgs = 5;
assertEquals(expctdNumArgs, res.numArgs());
ExprFunction func = res.getFunction();
FunctionLabel expctdFuncLabel = new FunctionLabel("concat");
assertEquals(expctdFuncLabel, func.getFunctionSymbol());
List<Expr> fnArgs = func.getArgs();
String expctdArg1Str = (new StringBuilder()).append("\"")
.append(constStr1).append(" \"").toString();
assertEquals(expctdArg1Str, fnArgs.get(0).toString());
String expctdArg2Str = (new StringBuilder()).append("?")
.append(varStr1).toString();
assertEquals(expctdArg2Str, fnArgs.get(1).toString());
String expctdArg3Str = (new StringBuilder()).append("\" ")
.append(constStr2).append(" \"").toString();
assertEquals(expctdArg3Str, fnArgs.get(2).toString());
String expctdArg4Str = (new StringBuilder()).append("?")
.append(varStr2).toString();
assertEquals(expctdArg4Str, fnArgs.get(3).toString());
String expctdArg5Str = (new StringBuilder()).append("\" ")
.append(constStr3).append("\"").toString();
assertEquals(expctdArg5Str, fnArgs.get(4).toString());
}
开发者ID:AKSW,项目名称:sml-converters,代码行数:42,代码来源:RRUtilsTest.java
注:本文中的com.hp.hpl.jena.sparql.expr.ExprFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论