Skip to content

Instantly share code, notes, and snippets.

@rat10
Created September 27, 2024 18:48
Show Gist options
  • Save rat10/6c66e360c36b7d81bb3b9bc21fc16b96 to your computer and use it in GitHub Desktop.
Save rat10/6c66e360c36b7d81bb3b9bc21fc16b96 to your computer and use it in GitHub Desktop.
UCRs with "unified pipe syntax"
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF-star-for-CIDOC-CRM-events>
prefix ex: <http://example.org/tla/ontologies/2023/3/gender-assignment/>
prefix crm: <http://www.cidoc-crm.org/cidoc-crm/>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
base <http://example.org/tla/ontologies/2023/3/gender-assignment>
ex:Gender_Eunuch a crm:E55_Type ; rdfs:label "Eunuch" .
ex:Gender_Male a crm:E55_Type ; rdfs:label "Male" .
ex:Paphlagonian_family a crm:E74_Group ;
rdfs:label "Family of John, Michael, & brothers" .
ex:Ioannes_68 a crm:E21_Person ,
ex:Gender_Eunuch | ex:Gender_Assignment_Eunuch [| a crm:E17_Type_Assignment ;
crm:P14_carried_out_by ex:Paphlagonian_family ;
rdfs:label "Castration gender assignment" |] ;
rdfs:label "John the Orphanotrophos" .
<| ex:Ioannes_68 a ex:Gender_Male | ex:Gender_Assignment_Male_By_Decree |> a crm:E17_Type_Assignment ;
crm:P14_carried_out_by ex:emperor ;
crm:P182_inverse_starts_after_or_with_the_end_of ex:Gender_Assignment_Eunuch ;
rdfs:label "Gender assignment by decree".
<| ex:Ioannes_68 a ex:Gender_Male |> a crm:E17_Type_Assignment ;
crm:P14_carried_out_by ex:Paphlagonian_family ;
crm:P183_ends_before_the_start_of ex:Gender_Assignment_Eunuch ;
rdfs:label "Birth gender assignment" .
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF-star-for-contextualizing-historical-assertions>
# Unaccepted claims about Konstantinos
# the type assignment event assigning Konstantinos to type Male
<| ex:Konstantinos_62 a ex:Gender_Male | ex:Gender_Assignment__Male_A |> a crm:E17_Type_Assignment ;
star:asserted-by ex:Anna_Komnene ;
star:based-on ex:Alexiad_VI_8 .
# the type assignment event assigning Konstantinos to type Eunuch
<| ex:Konstantinos_62 a ex:Gender_Eunuch | ex:Gender_Assignment__Eunuch_A |> a crm:E17_Type_Assignment ;
crm:P4_has_time-span ex:Reign_of_Botaneiates ;
star:asserted_by ex:Michael_Syrian ;
star:based_on ex:Chronicle_III_5 .
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF-star-for-explanation-and-provenance-in-biological-data>
#GRAPH release:1 {
<Q14739#SIP9E6E0C5B850FBF4F> up:fullName "3-beta-hydroxysterol Delta (14)-reductase" [| a ex:Attribution;
up:manual true ;
up:evidence ECO:0000303 ;
up:source citation:16784888 |] .
#}
# Query like:
# SELECT * {
# GRAPH ?release { ?prot up:fullName ... [| a :ex:Attribution ; ... |] }
# }
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF-star-for-labelled-property-graphs>
:a :b :c [| :d 1 |], :c [| :e 1 |] .
########
# <https://github.com/w3c/rdf-ucr/wiki/Describing-a-Union-of-Changes-to-a-Named-Graph>
PREFIX : <http://example.org/ns#>
BASE <http://example.com/>
### Quotation Shorthand of Blame View
<7d5d0d651caa> a :Text | <data?version=2> .
<| <7d5d0d651caa> a :Work | <data?version=1> |> .
<| <7d5d0d651caa> a :Work |> :retractedIn <data?version=2> .
<| <7d5d0d651caa> :subject <semantics> | <data?version=2> |> :suggestedBy <classifyer> .
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF%E2%80%90star-for-Annotations-as-Miscellaneous-Marginalia>
prefix bibo: <http://purl.org/ontology/bibo/>
<print> bibo:isbn "123" [| bf:status st:invalid ;
bf:source [ :backCoverOf <print> ] |] .
<print> bf:relatedTo [
bf:electronicLocator <cover-page.jpg> ;
dc:creator <e-michael-mitchell> [|
dc:source <https://americanwritersmuseum.org/stories-behind-classic-book-covers-the-catcher-in-the-rye/>
|]
] [| rdfs:comment "Cover page"@en |] .
<illustration_activity> a prov:Activity;
prov:used <aggregated_by_regions> [|
prov:atTime "2011-07-14T03:03:03Z"^^xsd:dateTime
|] ;
prov:wasAssociatedWith <derek> [|
prov:hadRole <illustrationist>;
prov:hadPlan <tutorial_blog>
|] .
<bar_chart> a prov:Entity;
prov:wasGeneratedBy <illustration_activity> [|
prov:atTime "2011-07-14T15:52:14Z"^^xsd:dateTime;
|] ;
prov:wasDerivedFrom <aggregated_by_regions> [|
prov:hadActivity <aggregating_activity>;
prov:hadUsage <use_of_aggregated_data>;
prov:hadGeneration <generation_of_bar_chart>
|] .
########
# <https://github.com/w3c/rdf-ucr/wiki/RDF%E2%80%90star-for-Detailed-Provenance-in-Cooperative-Union-Cataloguing>
<p1> a :Person ;
:birthDate "1901" [| :source <wikidata/p1> |] .
<| <p1> :birthDate "1902" |> :source <book/x> .
<http://www.wikidata.org/entity/Q102071> a sdo:Person ;
rdfs:label "Tove Jansson"@fi ;
sdo:deathDate "+2001-06-27T00:00:00Z"^^xsd:dateTime [|
:importedFromWikimediaProject_P143 <http://www.wikidata.org/entity/Q328> |],
"+2001-06-27T00:00:00Z"^^xsd:dateTime [| :statedIn_P248 <http://www.wikidata.org/entity/Q36578> ;
:retrieved_P813 "+2014-04-24T00:00:00Z"^^xsd:dateTime |],
"+2001-06-27T00:00:00Z"^^xsd:dateTime [| :statedIn_P248 <http://www.wikidata.org/entity/Q17299517> ;
:referenceUrl_P854 <http://explore.rkd.nl/en/explore/artists/233126> ;
:rkdartistsId_P650 "233126" ;
dct:title "Tove Jansson"@en |],
"+2001-06-27T00:00:00Z"^^xsd:dateTime [| :statedIn_P248 <http://www.wikidata.org/entity/Q2629164> ;
:internetSpeculativeFictionDatabaseAuthorId_P1233 "2148" ;
:subjectNamedAs_P1810 "Tove Jansson" ;
:retrieved_P813 "+2017-10-09T00:00:00Z"^^xsd:dateTime |] .
<introduction-to-physics> a :Text [|
rdfs:comment "This is an audio book."@en [|
dc:created "2023-05-20T09:14:30Z"^^xsd:dateTime |] |] ;
bf:classification <literature-education-physics> [|
bf:assigner <annif> ;
dc:date "2023-05-20T08:44:06Z"
|] .
<| <introduction-to-physics> a :Audio |> rdfs:comment "This is probably true."@en [|
dc:created "2023-05-20T09:14:59Z"^^xsd:dateTime |] .
<| <introduction-to-physics> bf:classification <literature-education-physics> |>
dc:creator <annif> ;
dc:date "2023-05-20T08:44:06Z"^^xsd:dateTime .
<| <introduction-to-physics> bf:classification <literature-education-astrology> |> bf:assigner <annif> .
<| <introduction-to-physics> bf:classification <literature-education-astrology> |> rdfs:comment "Not correct." .
wd:Q7835 a wikibase:Item ;
wdt:P131 wd:Q756294 [| :startTime "1991-02-12T00:00:00Z"^^xsd:dateTime ;
:statementDisputedBy wd:Q159 ;
wikibase:rank wikibase:PreferredRank |] ,
wd:Q15966495 [| :startTime "2014-03-18T00:00:00Z"^^xsd:dateTime ;
:statementDisputedBy wd:Q212 ;
wikibase:rank wikibase:PreferredRank |] .
<x> a :Text ;
:usageAndAccessPolicy <reserved> [| :sourceConsulted <archive/unit/x> |] .
########
# <https://github.com/w3c/rdf-ucr/issues/24>
prefix prov: <http://www.w3.org/ns/prov#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix wd: <http://www.wikidata.org/entity/>
prefix pq: <http://www.wikidata.org/prop/qualifier/>
prefix wdref: <http://www.wikidata.org/entity/>
prefix wikibase: <http://wikiba.se/ontology#>
wd:USA wd:president wd:JoeBiden [| a wikibase:Statement ;
wikibase:rank wikibase:PreferredRank ;
pq:start_date "2021-01-20"^^xsd:dateTime ;
pq:predecessor wd:DonaldTrump ;
prov:wasDerivedFrom wdref:a_reference , wdref:an_other_reference |] .
<| wd:USA wd:president wd:DonaldTrump |> a wikibase:Statement ;
wikibase:rank wikibase:NormalRank ;
pq:start_date "2017-01-20"^^xsd:dateTime ;
pq:start_date "2021-01-20"^^xsd:dateTime .
wd:Russia wd:president wd:VladimirPutin [| a wikibase:Statement ;
wikibase:rank wikibase:NormalRank ;
pq:start_date "1999-12-31"^^xsd:dateTime ;
pq:end_date "2008-05-07"^^xsd:dateTime |],
wd:VladimirPutin [| a wikibase:Statement ;
wikibase:rank wikibase:PreferredRank ;
pq:start_date "2012-05-07"^^xsd:dateTime |] .
########
# <https://github.com/w3c/rdf-ucr/issues/25>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX schema: <https://schema.org/>
PREFIX adr: <http://example.org/ns/adr#>
adr:Event1 schema:location adr:Place1 [| prov:wasDerivedFrom adr:Dataset\#1, adr:Dataset\#2 ;
prov:wasGeneratedBy [ a prov:Activity ;
prov:used adr:AssertionAlgorithm\#1 ;
prov:endedAtTime "2023-09-20T20:00:00-04:00"^^xsd:dateTime ] |] .
<| adr:Event1 schema:location adr:Place2 |> prov:wasDerivedFrom adr:Dataset\#3, adr:Dataset\#4 .
########
# <https://github.com/w3c/rdf-ucr/issues/26>
#<charlesdodgson> :says <| [] :name "Alice" ; :birthDate "1852" |> .
<charlesdodgson> :says <| _:b1 :name "Alice" |>, <| _:b1 :birthDate "1852" |> .
[] :givenName "Alice" | _:d1 ;
:familyName "Liddell" | _:d1 ;
:birthDate "1852-05-04" | _:d1 .
_:d1 dc:source <https://en.wikipedia.org/wiki/Alice_Liddell> ;
dc:date "2023-10-23" .
<report> bibo:authorList (<a> <b> <c>) [| dc:source <a> ; ex:disputedBy <c> |] .
<| <report> bibo:authorList (<c> <b> <a>) |> dc:source <c> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment