SPARQL查询ImageGrid视图无法显示全部结果的问题求助
问题:ImageGrid视图无法显示无图片的SPARQL查询结果?
我编写了一个SPARQL查询,用于筛选符合特定条件的女性艺术家,希望在查询结果中加入艺术家的图片(属性P18),以便设置#defaultView: ImageGrid视图时,既能展示所需数据,也能显示对应艺术家的图片。考虑到部分艺术家可能没有图片数据,我使用了OPTIONAL子句,避免丢失无图片艺术家的条目。
但将默认视图设置为ImageGrid后,我无法看到全部查询结果,必须切换到Table View才能查看所有条目。
查询语句
#defaultView:ImageGrid SELECT distinct (year(?birthDate) as ?year) ?person ?personLabel (count(distinct ?notablework) as ?workCount) (GROUP_CONCAT(DISTINCT ?notableworkLabel; separator="; ") AS ?works ) (sample(?image) as ?imageSample) ?placeOfBirth ?cood WHERE { ?person wdt:P106 wd:Q483501 . ?person rdfs:label ?personLabel . FILTER (LANG ( ?personLabel ) = "en" ) ?person wdt:P21 wd:Q6581072 . ?person wdt:P569 ?birthDate . ?person wdt:P800 ?notablework . ?notablework rdfs:label ?notableworkLabel . FILTER (LANG ( ?notableworkLabel ) = "en" ) FILTER(year(?birthDate) > 1899 && year(?birthDate) < 2000) ?person wdt:P27 wd:Q30 . ?person wdt:P6379 wd:Q160236. OPTIONAL {?person wdt:P18 ?image} . OPTIONAL {?person wdt:P19 ?country . ?country rdfs:label ?placeOfBirth . ?country wdt:P625 ?cood . FILTER (LANG ( ?placeOfBirth ) = "en") } } GROUP BY ?person ?personLabel ?placeOfBirth ?cood ?birthDate HAVING (?workCount >= 3) ORDER BY ?personLabel
我使用的OPTIONAL子句是第30行的:OPTIONAL {?person wdt:P18 ?image} .
查询实际返回7条结果,但ImageGrid视图仅显示3条。我原本期望添加OPTIONAL子句后,ImageGrid视图能显示全部7条结果,无图片的条目会显示类似“图片不可用”的提示,但实际并未实现。我尝试切换Firefox和Chrome浏览器,问题依旧存在。
请问:在SPARQL中是否有方法实现该需求?还是说我期望的这种布局并不被该服务支持?
内容的提问来源于stack exchange,提问作者silfurberg
相关产品推荐
相关产品推荐

