Skip to content

Instantly share code, notes, and snippets.

@pchampin
Last active June 25, 2022 13:09
Show Gist options
  • Save pchampin/06fe9ee68e1afee3d68c242ea0d5627e to your computer and use it in GitHub Desktop.
Save pchampin/06fe9ee68e1afee3d68c242ea0d5627e to your computer and use it in GitHub Desktop.
RDF-star "ocurrence" pattern vs. Schema.org "role" pattern
@prefix s: <http://schema.org/>.
# simple (unqualified) statement
:dr_strangelove a s:Movie ;
s:actor :peter_sellers.
# RDF-star with "ocurrence" nodes
:dr_strangelove a s:Movie ;
s:actor :peter_sellers {|
s:withPerformanceRole [
s:characterName "Group captain Lionel Mandrake"
], [
s:characterName "Dr Strangelove"
]
|}.
## NB: the original triple (:dr_strangelove s:actor :peter_sellers)
## is still in the graph,
## so queries like ':dr_strangelove s:actor ?a' still work
# Schema.org "role" pattern
:dr_strangelove a s:Movie ;
s:actor [
a s:PerfomanceRole ;
s:characterName "Group captain Lionel Mandrake" ;
s:actor :peter_sellers ;
], [
a s:PerfomanceRole ;
s:characterName "Dr Strangelove" ;
s:actor :peter_sellers ;
].
## NB: the original triple (:dr_strangelove s:actor :peter_sellers)
## is not in the graph anymore, so queries need to be changed.
## Furthermore, queries like ':dr_strangelove s:actor ?a'
## may now return a mix of Actors and PerformanceRoles
## (because some s:actor relations may still be in simple form).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment