的所有细节我有以下SPARQL查询:SPARQL筛选:获得匹配
PREFIX spec: <http://rdfs.org/sioc/spec/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX constraint: <http://purl.org/vocab/constraint/constraint#>
SELECT
(sample(?FName) as ?fName)
(sample(?Midname) as ?midname)
(sample(?User) as ?user)
(GROUP_CONCAT(DISTINCT ?userRole; separator='; ') AS ?UserRole)
WHERE {
GRAPH <http://example.com/>
{
?User spec:email ?Email .
?User foaf:firstName ?FirstName .
?User foaf:surname ?Midname .
OPTIONAL
{
?User constraint:containsConstraint ?constraint .
?constraint constraint:constrains ?userRoleUri .
?userRoleUri spec:name ?userRole.
}
FILTER (str(?userRoleUri) IN("http://example.com/roles/admin", "http://example.com/roles/moderator"))
}
} GROUP BY ?FName ORDER BY ASC(?FName)
什么这个查询的作用是它返回匹配的用户。 因此,如果用户“A”列出了3个角色:编辑者,管理员和主持人,则它仅显示用户的两个角色。 像:
A - Mid - [email protected] - admin;moderator
什么,我想从查询做的是: 因为用户A匹配任何给定的过滤条件,所有的IT的角色应该被列出。有没有办法改善这个查询?我一直在使用滤镜分选和正则表达式也尝试过,但:(
在此先感谢 Sparqler
在http://answers.semanticweb.com/questions/20016/sparql-filter-get-all-details一些重复的答案-of-a-match – RobV
thnx,我在sematicweb上提出了这个问题,但是我不确定语义web = stackoverflow ... – Ravish
它不是,它们由单独的人员运行,但将人员指向重复项以便将来的用户可以找到所有可用的答案 – RobV