我有一个表(FCT_POPULATION),它的结构如下,表示单个城市多年来的范围。因此,在同一年,我有两个量值,根据一个范围(ids 1或2)而变化:
CITY_ID | YEAR | RANGE_ID | QTY
-------------------------------
1100015 | 2021 | 1 | 134
1100015 | 2021 | 2 | 221
1100015 | 2022 | 1 | 158
1100015 | 2022 | 2 | 243由于它们是多年来对同一城市的多个度量,所以我希望创建这样一个RDF结构,其中包含一个空白节点列表,表示每个城市的元组(年份、范围、数量):
<http://localhost:2020/resource/populacao/1100015/2021> a db:Population ;
db:indicator
[ :year 2021, :range 1, :quantity 134] ;
db:indicator
[ :year 2021, :range 2, :quantity 221] .我的映射文件如下:
# Table FCT_POPULATION
map:Population a d2rq:ClassMap;
d2rq:dataStorage map:database;
d2rq:uriPattern "population/@@FCT_POPULATION.CITY_ID@@/@@FCT_POPULATION.YEAR@@";
d2rq:class :Population;
map:BN_Range_Year_QTY a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Population;
d2rq:property :indicator;
d2rq:refersToClassMap map:Range_Year_QTY;
.
map:Range_Year_QTY a d2rq:ClassMap;
d2rq:dataStorage map:database; #database connection is ok.
d2rq:bNodeIdColumns "FCT_POPULATION.YEAR,FCT_POPULATION.RANGE_ID,FCT_POPULATION.QTY";
.
map:quantity a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Range_Year_QTY ;
d2rq:property :quantity;
d2rq:column "FCT_POPULATION.QTY";
.
map:ano a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Range_Year_QTY ;
d2rq:property :year;
d2rq:column "FCT_POPULATION.YEAR";
.
map:faixa a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Range_Year_QTY ;
d2rq:property :range;
d2rq:column "FCT_POPULATION.RANGE_ID";
.它解析了ok,但是当我试图使用"http://localhost:2020/data/population/1100015/2014“解析特定的URI时,返回的是”空白“空白节点:
<http://localhost:2020/resource/populacao/1100015/2014>
a db:Population ;
db:indicator
[] ;
db:indicator
[] ;有什么建议吗?
我使用的是d2rq v0.8.1和PostgreSQL 14.2(x64) Windows8.1,命令行:d2r-server mapping.ttl
发布于 2022-07-01 18:44:09
在d2rq中解析URI是基于sparql描述的。您可以看到以url http://localhost:2020/snorql/可用的形式输入的结果。
DESCRIBE <http://localhost:2020/resource/populacao/1100015/2014>在结果中也没有你需要的值。这就是为什么通过http解析无法使用空节点的原因。
但是您的映射是正确的,例如,如果尝试使用
dump-rdf -f ttl -o data.ttl mapping.ttl您的所有数据都准备好了,因此您可以根据需要查询它们。
https://stackoverflow.com/questions/72757470
复制相似问题