繁体   English   中英

如何在耶拿sparql中使用过滤器进行子查询?

[英]how to subquery with filters in jena sparql?

我正在尝试在Jena Sparql的过滤器中应用子查询。这是否可能。如果是,如何?例如:

SELECT ?x WHERE(?y <xyz:> ?z . ?y <abc:> ?x .FILTER regex(?z,subquery,"i")}

我的意思是我想使用jena中的一些子查询在过滤器中给出表达式。我该怎么办?

您不能将子查询放入过滤器表达式中,因为子查询不是带有值的表达式。 但是,您可以使用子查询来提供您在过滤器表达式中使用的值。 例如,

# Find persons whose names are also the names of flowers (Rose, Daisy, etc.) by
# performing a subquery to find all the flower names, and then finding people 
# whose names match those names.
select ?person where {
  ?person a :Person ;
          :name ?name .
  filter regex(?name,?flowerName, "i" )

  { select ?flowerName { ?flower a :Flower ; :name ?flowerName } }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM