本文整理了Java中openllet.query.sparqldl.model.Query.getVars
方法的一些代码示例,展示了Query.getVars
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getVars
方法的具体详情如下:
包路径:openllet.query.sparqldl.model.Query
类名称:Query
方法名:getVars
[英]Return all the variables used in this query.
[中]返回此查询中使用的所有变量。
代码示例来源:origin: com.github.galigator.openllet/openllet-examples
/**
* The subsumption in this example holds because of the subproperty relation between hasBrother and hasSibling. however, The second query uses the variable
* name ?z instead of the the variable name ?y used in the first query. The query subsumption algorithm finds the mapping between query variables.
*/
public void example4()
{
final Query q7 = query("?x a family:Female; family:hasBrother ?y . ");
final Query q8 = query("?x a family:Female; family:hasSibling ?z .");
System.out.println("Example 4");
System.out.println("=========");
System.out.println("Query 7: " + q7.toString());
System.out.println("Query 8: " + q8.toString());
System.out.println();
System.out.println("Query 7 is subsumed by query 8: " + QuerySubsumption.isSubsumedBy(q7, q8));
System.out.print("Subsumption mappings: ");
final QueryResult mappings = QuerySubsumption.getSubsumptionMappings(q7, q8);
for (final ResultBinding mapping : mappings)
for (final Iterator<?> j = q8.getVars().iterator(); j.hasNext();)
{
final ATermAppl var = (ATermAppl) j.next();
System.out.print(var.getArgument(0) + " -> " + mapping.getValue(var)); //I get var(x) as opposed to x
if (j.hasNext())
System.out.print(", ");
}
System.out.println();
}
}
代码示例来源:origin: Galigator/openllet
/**
* The subsumption in this example holds because of the subproperty relation between hasBrother and hasSibling. however, The second query uses the variable
* name ?z instead of the the variable name ?y used in the first query. The query subsumption algorithm finds the mapping between query variables.
*/
public void example4()
{
final Query q7 = query("?x a family:Female; family:hasBrother ?y . ");
final Query q8 = query("?x a family:Female; family:hasSibling ?z .");
System.out.println("Example 4");
System.out.println("=========");
System.out.println("Query 7: " + q7.toString());
System.out.println("Query 8: " + q8.toString());
System.out.println();
System.out.println("Query 7 is subsumed by query 8: " + QuerySubsumption.isSubsumedBy(q7, q8));
System.out.print("Subsumption mappings: ");
final QueryResult mappings = QuerySubsumption.getSubsumptionMappings(q7, q8);
for (final ResultBinding mapping : mappings)
for (final Iterator<?> j = q8.getVars().iterator(); j.hasNext();)
{
final ATermAppl var = (ATermAppl) j.next();
System.out.print(var.getArgument(0) + " -> " + mapping.getValue(var)); //I get var(x) as opposed to x
if (j.hasNext())
System.out.print(", ");
}
System.out.println();
}
}
代码示例来源:origin: com.github.galigator.openllet/openllet-query
for (final ATermAppl a : query.getDistVarsForType(t))
if (aboxQuery.getVars().contains(a))
aboxQuery.addDistVar(a, t);
if (schemaQuery.getVars().contains(a))
schemaQuery.addDistVar(a, t);
if (aboxQuery.getVars().contains(a))
aboxQuery.addResultVar(a);
if (schemaQuery.getVars().contains(a))
schemaQuery.addResultVar(a);
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubClassOfAtom(v, ATermUtils.TOP));
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubPropertyOfAtom(v, v));
代码示例来源:origin: Galigator/openllet
for (final ATermAppl a : query.getDistVarsForType(t))
if (aboxQuery.getVars().contains(a))
aboxQuery.addDistVar(a, t);
if (schemaQuery.getVars().contains(a))
schemaQuery.addDistVar(a, t);
if (aboxQuery.getVars().contains(a))
aboxQuery.addResultVar(a);
if (schemaQuery.getVars().contains(a))
schemaQuery.addResultVar(a);
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubClassOfAtom(v, ATermUtils.TOP));
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubPropertyOfAtom(v, v));
代码示例来源:origin: Galigator/openllet
for (final ATermAppl a : query.getDistVarsForType(t))
if (aboxQuery.getVars().contains(a))
aboxQuery.addDistVar(a, t);
if (schemaQuery.getVars().contains(a))
schemaQuery.addDistVar(a, t);
if (aboxQuery.getVars().contains(a))
aboxQuery.addResultVar(a);
if (schemaQuery.getVars().contains(a))
schemaQuery.addResultVar(a);
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubClassOfAtom(v, ATermUtils.TOP));
if (!schemaQuery.getVars().contains(v))
schemaQuery.add(QueryAtomFactory.SubPropertyOfAtom(v, v));
代码示例来源:origin: com.github.galigator.openllet/openllet-query
final Set<ATermAppl> vars = query.getVars(); // getObjVars
代码示例来源:origin: Galigator/openllet
final Set<ATermAppl> vars = query.getVars(); // getObjVars
代码示例来源:origin: Galigator/openllet
final Set<ATermAppl> vars = query.getVars(); // getObjVars
内容来源于网络,如有侵权,请联系作者删除!