Search code examples
sparqlrdfjena

RDF - More than one Object for one Subject-Property


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?


Solution

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