我有以下示例 Turtle 文档:
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix example: <http://example.com/vocabulary/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
<http://example.com/datasets/1>
a dcat:Distribution ;
example:props [ example:prop1 "hello" ;
example:prop2 "1"
] ;
dct:description "test data" .
我使用 Apache Jena (RDFDataMgr with JSONLD_COMPACT_PRETTY) 将它转换为 JSON-LD 到 JSON-LD:
{
"@context": {
"dct": "http://purl.org/dc/terms/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"dcat": "http://www.w3.org/ns/dcat#",
"example": "http://example.com/vocabulary/"
},
"@graph": [
{
"@id": "_:b0",
"example:prop1": "hello",
"example:prop2": "1"
},
{
"@id": "http://example.com/datasets/1",
"@type": "dcat:Distribution",
"example:props": {
"@id": "_:b0"
},
"dct:description": "test data"
}
]
}
但实际上我想要一个嵌套对象而不是一个空白节点:
{
"@context": {
"dct": "http://purl.org/dc/terms/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"dcat": "http://www.w3.org/ns/dcat#",
"example": "http://example.com/vocabulary/"
},
"@graph": [
{
"@id": "http://example.com/datasets/1",
"@type": "dcat:Distribution",
"example:props": {
"example:prop1": "hello",
"example:prop2": "1"
},
"dct:description": "test data"
}
]
}
Apache Jena 有可能吗?它在语义上是否等效?