SPARQL 查询访问 JSON-LD 数组
SPARQL query to access inside a JSON-LD array
这是我的 JSON-LD :
"locationCreated": {
"@type": "Place",
"@id": "http://test.fr/city/pacific-grove",
"geo": {
"@type": "GeoCoordinates",
"@id": "http://test.fr/city/pacific-grove/geo",
"latitude": "36.6177374",
"longitude": "-121.9166215"
},
"name": "Pacific Grove",
"alternateName": "Pacific Grove, CA, USA"
}
我想使用 SPARQL 获取 latitude
& longitude
值。实际上,当我进行查询时,我只能访问 locationCreated
.
的 URI "http://test.fr/city/pacific-grove"
SPARQL 查询:
prefix schema: <http://schema.org/>
select ?locationCreated
where {
?x schema:locationCreated ?locationCreated
}
LIMIT 100
感谢您的回答。
根据您的样本数据,这应该有效:
prefix schema: <http://schema.org/>
select ?locationCreated ?lat ?long
where {
?x schema:locationCreated ?locationCreated .
?locationCreated schema:geo ?geoData .
?geoData schema:latitude ?lat .
?geoData schema:longitude ?long .
}
LIMIT 100
这是我的 JSON-LD :
"locationCreated": {
"@type": "Place",
"@id": "http://test.fr/city/pacific-grove",
"geo": {
"@type": "GeoCoordinates",
"@id": "http://test.fr/city/pacific-grove/geo",
"latitude": "36.6177374",
"longitude": "-121.9166215"
},
"name": "Pacific Grove",
"alternateName": "Pacific Grove, CA, USA"
}
我想使用 SPARQL 获取 latitude
& longitude
值。实际上,当我进行查询时,我只能访问 locationCreated
.
"http://test.fr/city/pacific-grove"
SPARQL 查询:
prefix schema: <http://schema.org/>
select ?locationCreated
where {
?x schema:locationCreated ?locationCreated
}
LIMIT 100
感谢您的回答。
根据您的样本数据,这应该有效:
prefix schema: <http://schema.org/>
select ?locationCreated ?lat ?long
where {
?x schema:locationCreated ?locationCreated .
?locationCreated schema:geo ?geoData .
?geoData schema:latitude ?lat .
?geoData schema:longitude ?long .
}
LIMIT 100