Resource ambiguity with the same predicate in JSON-LD

I am having trouble figuring out how to disambiguate resources that use the same predicate in advance. I am new to RDF, so please excuse my terminology: I will try to explain what I mean with the examples.

I have an Interview resource / model with a (simplified) context like this:

 { "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" } } 

My Interviewer and Interviewee resources have the following contexts:

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

Then I create a resource that looks like this:

 { "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" ] } 

Everything is fine, and I can save this “object” in my repository (I use the RDF.rb libraries). However, problems arise when I try to retrieve an object and "re-serialize" it. For example (sorry Ruby code),

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

These lines retrieve the relevant statements from the repository, and then push them into the JSON-LD resource with the appropriate context. However, both the interlocutors and the interviewers are moved to the interviewees attribute.

Of course, this makes sense, since both interviewers and interviewees are associated with the Interview resource with the predicate dc:contributor (they differ only in their individual types).

I need to make the dump process aware of the associated resource types, but I don’t know how to add this information to the interview context.

I do not know if this is possible according to the current JSON-LS specifications. This problem seems to be relevant, but I really don't know enough about RDF / JSON-LD to know for sure.

I could use different predicates for interviewers and interviewees , but it seems like I shouldn't have done that. Any suggestions?

Note. I also asked this question at answers.semanticweb.com .

ADDITIONAL INFORMATION

I modeled my contributor relationship this way (where Interviewer is a contributor type http://id.loc.gov/vocabulary/relators/ivr ) based on one of the recommended ways to define DC properties. For example, you can express a MESH object on a resource, for example:

 <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> 

Suppose I had:

 <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> 

I would like to be able to refer to the lcsh_subjects "property, where lcsh_subjects represents those nodes that are connected to the resource using dc:subject AND, which are of type dcterms:LCSH . However, I understand that I probably think of the JSON-LD model wrong.

+6
source share
1 answer

You may be involved in using @id for interviewers and interviewees. You defined them both with the same @id, which means they are the same predicate. They are defined as contributors to the resource, but there is nothing to distinguish them from each other. You might think that what you mean by “interviewers” ​​is a predicate, which is a sub-property of dc: contributor, and the same for “respondents”. It might be better to choose an existing dictionary that already has the concept of interviewers and interviewees. Alternatively, create your own vocabulary that defines the terms you need, and use it to create context types.

You also avoid the URIs used in your object (for example, "http://purl.org/dc/terms/identifier") that may not give what you want, just use regular URIs like " http: / /purl.org/dc/terms/identifier ".

(In addition, you use the “info” prefix, which is undefined. And there is no need to declare @context at every level).

For example, you might consider creating http://example.foo/my-vocab# and defining properties inside this (of course, using your own IRI with the ability to differentiate):

 { "@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" } } ] } 

Then you can use this with the context of your object as follows:

 { "@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" ] } 

(Also check this out on the JSON-LD playground

If you turn this into something like Turtle (try http://rdf.greggkellogg.net/ ), you will get the following:

 @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" . 
+7
source

All Articles