RDF - More than one Object for one Subject-Property
Asked Answered
I

1

7

I've got one (maybe) simple question: Can I assign more than one ObjectResource to a fixed Subject-Property Statement?

I want my RDF-Triples look like that:

[http://somewhere/Angela_Merkel, http://somewhere/properties#isMentionedIn, http://somewhere/New_York_Times]

[http://somewhere/Angela_Merkel, http://somewhere/properties#isMentionedIn, http://somewhere/The_Guardian]

[http://somewhere/Angela_Merkel, http://somewhere/properties#isMentionedIn, http://somewhere/BildZeitung]

and so on.. Is this rdf well-formed?

And can I implement this in Apache Jena?

Iveson answered 15/9, 2016 at 7:50 Comment(1)
The format that you've got is actually very close to N-Triples already. Writing as <http://somewhere/Angela_Merkel> <http://somewhere/properties#isMentionedIn> <http://somewhere/New_York_Times> . you'd have legal N-Triples format, and you could actually test whether the RDF can be loaded.River
F
6

Yes this would be well formed data and it is a common way to define multiple values for a given property on a given subject.

RDF has very few restrictions on what triples you can declare. Essentially these boil down to the following:

  • The subject must be a IRI/blank node
  • The predicate must be a IRI
  • The object may be a IRI/blank node/literal
  • Duplicate triples are ignored i.e. Declaring the same triple multiple times is the same as declaring it once

IRIs are a superset of URIs - see RFC 3987 for more details. TL;DR IRIs are basically URIs with a wider permitted character set to allow internationalised identifiers

Beyond that you are free to declare as many triples as you want.

You can certainly implement this with Apache Jena, I would suggest starting with the Introduction Tutorial and asking new more specific questions if you get stuck.

Forego answered 15/9, 2016 at 9:44 Comment(2)
Thank you very much. Yeah, i looked through some Introductions, but i became a little nervous, so i asked. Cheers, FFoDWindow.Iveson
The spec says IRI instead of URI. The space of possible IRIs is a superset of the space of possible URIs.Leap

© 2022 - 2024 — McMap. All rights reserved.