JSON ドキュメントからトリプルを生成するためにhttps://github.com/jsonld-java/jsonld-javaを使用しています。私は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 Options 構成を使用しています
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 .
ポインタや提案は素晴らしいでしょう。