7

同じ述語を使用するリソースを事前に明確にする方法がわかりません。私は RDF の初心者なので、用語についてはご容赦ください。例を挙げて説明したいと思います。

次のような(簡略化された)コンテキストを持つInterviewリソース/モデルがあります。

{
  "id": {
    "@id": "http://purl.org/dc/terms/identifier"
  },
  "interviewers": {
    "@id": "http://purl.org/dc/terms/contributor",
    "@type": "@id",
    "@container": "@set"
  },
  "title": {
    "@id": "http://purl.org/dc/terms/title"
  },
  "interviewees": {
    "@id": "http://purl.org/dc/terms/contributor",
    "@type": "@id",
    "@container": "@set"
  }
}

myInterviewerIntervieweeresources には、次のようなコンテキストがあります。

{
  "id": {
    "@id": "http://purl.org/dc/terms/identifier"
  },
  "name": {
    "@id": "info:repository/ive/name"
  }
}

次に、次のようなリソースを作成します。

{
  "id": "06bad25f-83c1-4ee5-b055-0cb87d4c06be",
  "interviewers": [
    {
      "id": "b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "name": "Somebody",
      "@context": {
        ...
      },
      "@id": "urn:uuid:b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "@type": [
        "http://id.loc.gov/vocabulary/relators/ivr"
      ]
    }
  ],
  "title": "Interview with So and So",
  "interviewees": [
    {
      "id": "bd6bb9ec-f417-4f81-af69-e3d191e3f73b",
      "name": "A third person",
      "gender": "male",
      "@context": {
        ...
      },
      "@id": "urn:uuid:bd6bb9ec-f417-4f81-af69-e3d191e3f73b",
      "@type": [
        "http://id.loc.gov/vocabulary/relators/ive"
      ]
    }
  ],
  "@context": {
    ...
  },
  "@id": "urn:uuid:06bad25f-83c1-4ee5-b055-0cb87d4c06be",
  "@type": [
    "info:repository/interview"
  ]
}

すべて問題なく、この「オブジェクト」をリポジトリに保存できます (RDF.rb ライブラリを使用しています)。ただし、オブジェクトを抽出して「再シリアル化」しようとすると、問題が発生します。たとえば (Ruby コードですみません)、

query = repository.query(:subject => RDF::URI(uri))
JSON.parse(query.dump(:jsonld, :context => Interview.context))

これらの行は、関連するステートメントをリポジトリから抽出し、適切なコンテキストを使用して JSON-LD "リソース" にマッシュアップします。ただし、インタビュイーとインタビュアーの両方がinterviewees属性に移動されます。

もちろん、これは完全に理にかなっています。なぜなら、interviewersとの両方が述語を持つリソースにinterviewees関連しているからです(それらは個々のタイプによってのみ区別されます)。interviewdc:contributor

関連するリソース タイプをプロセスに認識させる必要がありdumpますが、その情報をインタビューのコンテキストに追加する方法がわかりません。

現在の JSON-LS 仕様に従ってこれが可能かどうかはわかりません。この問題は関連しているように見えますが、RDF/JSON-LD について確実に知るには十分な知識がありません。

interviewersとに異なる述語を使用できますintervieweesが、そうする必要はないようです。助言がありますか?

注: answer.semanticweb.comでもこの質問をしました。

追加情報

DC プロパティを修飾するための推奨される方法の 1 つに基づいてcontributor、この方法で関係をモデル化しました(ここで、 aninterviewercontributora type です)。http://id.loc.gov/vocabulary/relators/ivrたとえば、次のようなリソースで MESH サブジェクトを表現できます。

<rdf:Description>
  <dc:subject>
    <dcterms:MESH>
      <rdf:value>D08.586.682.075.400</rdf:value>
      <rdfs:label>Formate Dehydrogenase</rdfs:label>
    </dcterms:MESH>
  </dc:subject>
</rdf:Description>

私が持っていたとします:

<rdf:Description>
  <dc:subject>
    <dcterms:MESH>
      <rdf:value>D08.586.682.075.400</rdf:value>
      <rdfs:label>Formate Dehydrogenase</rdfs:label>
    </dcterms:MESH>
  </dc:subject>
  <dc:subject>
    <dcterms:LCSH>
      <rdf:value>Formate Dehydrogenase</rdf:value>
    </dcterms:LCSH>
  </dc:subject>
</rdf:Description>

lcsh_subjects「プロパティ」を参照できるようにしたいと思います。ここでlcsh_subjectsは、リソースに関連するdc:subjectAND を持つノードを表し、タイプはdcterms:LCSHです。しかし、私はおそらく JSON-LD モデルについて間違った方法で考えていることに気付きました。

4

1 に答える 1

9

インタビュアーとインタビュイーの両方に使用する @id について混乱するかもしれません。両方を同じ @id で定義しました。つまり、それらは同じ述語です。それらはリソースへの貢献者として定義されていますが、それらを互いに区別するものは何もありません。「interviewers」とは、dc:contributor のサブプロパティである述語であり、「interviewees」についても同じであると考えることができます。インタビュアーとインタビュイーの概念を既に持っている既存の語彙を選択する方が良いかもしれません。または、必要な用語を定義する独自の語彙を作成し、これを使用してコンテキスト タイプを作成します。

また、オブジェクト内で使用されている URI (たとえば、「http://purl.org/dc/terms/identifier」) をエスケープしているため、必要な結果が得られない可能性があります。「http://などの通常の URI を使用してください。 purl.org/dc/terms/identifier ".

(また、未定義の "info" プレフィックスを使用します。また、すべてのレベルで @context を宣言する必要はありません)。

たとえば、http://example.foo/my-vocab#を作成し、その中でプロパティを定義することを検討できます (もちろん、独自の参照解除可能な IRI を使用します)。

{
  "@context": {
    "dc": "dc:identifier",
    "rdf": "URI:http:/www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
  },
  "@graph": [
    {
      "@id": "http://example.foo/interviewees",
      "@type": "rdf:Property",
      "rdfs:comment": "Interviewee",
      "rdfs:subPropertyOf": {
        "@id": "dc:contributor"
      }
    },
    {
      "@id": "http://example.foo/interviewers",
      "@type": "rdf:Property",
      "rdfs:comment": "Interviewer",
      "rdfs:subPropertyOf": {
        "@id": "dc:contributor"
      }
    }
  ]
}

次に、次のようにオブジェクトのコンテキストでこれを使用できます。

{
  "@context": {
    "id": "http://purl.org/dc/terms/identifier",
    "myvocab": "http://example.foo/myvocab#",
    "info": "http://example.foo/info#",
    "interviewers": {
      "@id": "myvocab:interviewers",
      "@type": "@id",
      "@container": "@set"
    },
    "title": "http://purl.org/dc/terms/title",
    "interviewees": {
      "@id": "myvocab:interviewees",
      "@type": "@id",
      "@container": "@set"
    }
  },
  "id": "06bad25f-83c1-4ee5-b055-0cb87d4c06be",
  "interviewers": [
    {
      "id": "b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "name": "Somebody",
      "@id": "urn:uuid:b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "@type": [
        "http://id.loc.gov/vocabulary/relators/ivr"
      ]
    }
  ],
  "title": "Interview with So and So",
  "interviewees": [
    {
      "id": "bd6bb9ec-f417-4f81-af69-e3d191e3f73b",
      "name": "A third person",
      "gender": "male",
      "@id": "urn:uuid:bd6bb9ec-f417-4f81-af69-e3d191e3f73b",
      "@type": [
        "http://id.loc.gov/vocabulary/relators/ive"
      ]
    }
  ],
  "@id": "urn:uuid:06bad25f-83c1-4ee5-b055-0cb87d4c06be",
  "@type": [
    "info:repository/interview"
  ]
}

(また、 JSON-LD プレイグラウンドでこれをチェックしてください

これを Turtle のようなものにすると ( http://rdf.greggkellogg.net/を試してください)、次のようになります。

@prefix dc: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<urn:uuid:06bad25f-83c1-4ee5-b055-0cb87d4c06be> a <http://example.foo/info#repository/interview>;
   dc:title "Interview with So and So";
   <http://example.foo/myvocab#interviewees> <urn:uuid:bd6bb9ec-f417-4f81-af69-e3d191e3f73b>;
   <http://example.foo/myvocab#interviewers> <urn:uuid:b0c262ce-7eb3-47f2-b212-a0e71cca0c92>;
   dc:identifier "06bad25f-83c1-4ee5-b055-0cb87d4c06be" .

<urn:uuid:b0c262ce-7eb3-47f2-b212-a0e71cca0c92> a <http://id.loc.gov/vocabulary/relators/ivr>;
   dc:identifier "b0c262ce-7eb3-47f2-b212-a0e71cca0c92" .

<urn:uuid:bd6bb9ec-f417-4f81-af69-e3d191e3f73b> a <http://id.loc.gov/vocabulary/relators/ive>;
   dc:identifier "bd6bb9ec-f417-4f81-af69-e3d191e3f73b" .
于 2014-01-18T20:30:29.943 に答える