我正在使用https://github.com/jsonld-java/jsonld-java从 JSON 文档生成三元组。我是 json-ld 的新手,我想知道有没有办法生成 @id 为文字的三元组,或者 @id 是否需要 IRI。?
示例 Json 输入:
[
{
"@context": {
"@vocab": "http://schema.org/",
"@base": "test.com"
},
"@graph": [
{
"@type": [
"Person",
"Entity"
],
"@id": "abcdef",
"personName": "David"
}
]
}
]
代码片段:
JsonLdProcessor.toRDF(obj, options)
对于选项,我使用以下 JsonLd 选项配置
this.format = "application/nquads"
上述文件不会产生任何三元组。当我将上述 json 文档中的 @id 字段更改为“@id”:“ http://abcdef ”时,它会生成以下三元组。
<http://abcdef> <http://schema.org/personName> "David" _:b0 .
<http://abcdef> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Entity> _:b0 .
<http://abcdef> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> _:b0 .
任何指示或建议都会很棒。