% swift build -c release
创建内存端点,并将数据加载到默认图中
% ./.build/release/kineo-endpoint -m --default-graph=examples/geo-data/geo.ttl &
或者,可以创建持久数据库文件 (geo.db
) 并离线加载 N-Triples 或 Turtle 文件
% ./.build/release/kineo-create-db -q geo.db --default-graph=examples/geo-data/geo.ttl
加载数据后,可以使用此持久数据库启动端点
./.build/release/kineo-endpoint -q geo.db &
可以使用 SPARQL 协议查询数据
% curl -s -H "Accept: application/sparql-results+json" -H "Content-Type: application/sparql-query" --data 'PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT ?s ?lat ?long WHERE { ?s geo:lat ?lat ; geo:long ?long } LIMIT 1' 'https://:8080/sparql' | jq .
{
"head": {
"vars": [ "s", "lat", "long" ]
},
"results": {
"bindings": [
{
"lat": {
"datatype": "http://www.w3.org/2001/XMLSchema#float",
"type": "literal",
"value": "51.78333333333333"
},
"long": {
"datatype": "http://www.w3.org/2001/XMLSchema#float",
"type": "literal",
"value": "4.616666666666667"
},
"s": {
"type": "uri",
"value": "http://dbpedia.org/resource/'s-Gravendeel"
}
}
]
}
}