datprop2rd.ttl 18.1 KB
# baseURI: http://www.reportinghub.no/refdata/transform/datprop2rd
# imports: http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003
# imports: http://rds.posccaesar.org/2008/06/OWL/RDL-annotations
# imports: http://spinrdf.org/spin
# imports: http://www.reportinghub.no/ep/schema/1.0/core
# imports: http://www.reportinghub.no/refdata/foundation

@prefix :        <http://www.reportinghub.no/refdata/transform/datprop2rd#> .
@prefix RDL-annotations:  <http://rds.posccaesar.org/2008/06/OWL/RDL-annotations#> .
@prefix RDL_ERHFoundationRD:  <http://www.reportinghub.no/refdata/foundation#> .
@prefix afn:     <http://jena.hpl.hp.com/ARQ/function#> .
@prefix fn:      <http://www.w3.org/2005/xpath-functions#> .
@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#> .
@prefix smf:     <http://topbraid.org/sparqlmotionfunctions#> .
@prefix sp:      <http://spinrdf.org/sp#> .
@prefix spif:    <http://spinrdf.org/spif#> .
@prefix spin:    <http://spinrdf.org/spin#> .
@prefix spl:     <http://spinrdf.org/spl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

<http://www.reportinghub.no/refdata/transform/datprop2rd>
      rdf:type owl:Ontology ;
      owl:imports <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003> , <http://rds.posccaesar.org/2008/06/OWL/RDL-annotations> , <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/refdata/foundation> ;
      owl:versionInfo "Created with TopBraid Composer"^^xsd:string .

owl:DatatypeProperty
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0310 Set URI and designation for EHR RD from Datatype Property that are not UoM"^^xsd:string ;
                sp:templates ([ sp:object
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "desigation"^^xsd:string
                                    ] ;
                            sp:predicate <http://posccaesar.org/rdl/hasDesignation> ;
                            sp:subject
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ]
                          ] [ sp:object
                                    [ sp:varName "definition"^^xsd:string
                                    ] ;
                            sp:predicate <http://posccaesar.org/rdl/hasDefinition> ;
                            sp:subject
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ]
                          ] [ sp:object
                                    [ sp:varName "pcaid"^^xsd:string
                                    ] ;
                            sp:predicate <http://posccaesar.org/rdl/hasIdPCA> ;
                            sp:subject
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ]
                          ] [ sp:object <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#ClassOfClassOfRepresentation> ;
                            sp:predicate rdf:type ;
                            sp:subject
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ]
                          ]) ;
                sp:where ([ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object
                                                [ sp:varName "same"^^xsd:string
                                                ] ;
                                        sp:predicate owl:sameAs ;
                                        sp:subject spin:_this
                                      ])
                          ] [ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object
                                                [ sp:varName "seerd"^^xsd:string
                                                ] ;
                                        sp:predicate <http://www.reportinghub.no/ep/schema/core#seeReferenceData> ;
                                        sp:subject spin:_this
                                      ])
                          ] [ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object <http://www.reportinghub.no/ep/schema/core#Scale> ;
                                        sp:predicate rdf:type ;
                                        sp:subject spin:_this
                                      ])
                          ] [ sp:object
                                    [ sp:varName "definition"^^xsd:string
                                    ] ;
                            sp:predicate rdfs:comment ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "label"^^xsd:string
                                    ] ;
                            sp:predicate rdfs:label ;
                            sp:subject spin:_this
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:generateUUID
                                    ] ;
                            sp:variable
                                    [ sp:varName "uuid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type fn:concat ;
                                      sp:arg1 "ERH" ;
                                      sp:arg2 [ sp:varName "uuid"^^xsd:string
                                              ]
                                    ] ;
                            sp:variable
                                    [ sp:varName "pcaid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:buildURI ;
                                      sp:arg1 "<http://posccaesar.org/rdl/{?pcaid}>"
                                    ] ;
                            sp:variable
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type fn:upper-case ;
                                      sp:arg1 [ rdf:type xsd:string ;
                                                sp:arg1 [ sp:varName "label"^^xsd:string
                                                        ]
                                              ]
                                    ] ;
                            sp:variable
                                    [ sp:varName "desigation"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0320 Set sameAs for RD items already in PCA RDL"^^xsd:string ;
                sp:templates ([ sp:object
                                    [ sp:varName "rduri"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ]) ;
                sp:where ([ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object
                                                [ sp:varName "same"^^xsd:string
                                                ] ;
                                        sp:predicate owl:sameAs ;
                                        sp:subject spin:_this
                                      ])
                          ] [ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object <http://www.reportinghub.no/ep/schema/core#Scale> ;
                                        sp:predicate rdf:type ;
                                        sp:subject spin:_this
                                      ])
                          ] [ sp:object
                                    [ sp:varName "seerd"^^xsd:string
                                    ] ;
                            sp:predicate <http://www.reportinghub.no/ep/schema/core#seeReferenceData> ;
                            sp:subject spin:_this
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type smf:buildURI ;
                                      sp:arg1 [ sp:varName "seerd"^^xsd:string
                                              ]
                                    ] ;
                            sp:variable
                                    [ sp:varName "rduri"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0330 Set Property ClassOfRepresented"^^xsd:string ;
                sp:templates ([ sp:object
                                    [ sp:varName "rdform"^^xsd:string
                                    ] ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassOfPattern> ;
                            sp:subject
                                    [ sp:varName "rdproperty"^^xsd:string
                                    ]
                          ]) ;
                sp:where ([ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object <http://www.reportinghub.no/ep/schema/core#Scale> ;
                                        sp:predicate rdf:type ;
                                        sp:subject spin:_this
                                      ])
                          ] [ sp:object
                                    [ sp:varName "rdproperty"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "range"^^xsd:string
                                    ] ;
                            sp:predicate rdfs:range ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "rdform"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject
                                    [ sp:varName "range"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0330 Set Property ClassOfRepresented"^^xsd:string ;
                sp:templates ([ sp:object
                                    [ sp:varName "rdclass"^^xsd:string
                                    ] ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassOfRepresented> ;
                            sp:subject
                                    [ sp:varName "rdproperty"^^xsd:string
                                    ]
                          ]) ;
                sp:where ([ rdf:type sp:NotExists ;
                            sp:elements ([ sp:object <http://www.reportinghub.no/ep/schema/core#Scale> ;
                                        sp:predicate rdf:type ;
                                        sp:subject spin:_this
                                      ])
                          ] [ sp:object
                                    [ sp:varName "rdproperty"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "domain"^^xsd:string
                                    ] ;
                            sp:predicate rdfs:domain ;
                            sp:subject spin:_this
                          ] [ sp:object
                                    [ sp:varName "rdclass"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject
                                    [ sp:varName "domain"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0395 Handle classification of RD property as ERH Class"^^xsd:string ;
                sp:templates ([ sp:object <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#Classification> ;
                            sp:predicate rdf:type ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ] [ sp:object
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ] ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassified> ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ] [ sp:object <http://posccaesar.org/rdl/ERH00001> ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassifier> ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ]) ;
                sp:where ([ sp:object
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:generateUUID
                                    ] ;
                            sp:variable
                                    [ sp:varName "uuid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type fn:concat ;
                                      sp:arg1 "ERH" ;
                                      sp:arg2 [ sp:varName "uuid"^^xsd:string
                                              ]
                                    ] ;
                            sp:variable
                                    [ sp:varName "pcaid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:buildURI ;
                                      sp:arg1 "<http://posccaesar.org/rdl/{?pcaid}>"
                                    ] ;
                            sp:variable
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ])
              ] ;
      spin:rule
              [ rdf:type sp:Construct ;
                rdfs:comment "0395 Handle classification of RD property as ERH Thing"^^xsd:string ;
                sp:templates ([ sp:object <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#Classification> ;
                            sp:predicate rdf:type ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ] [ sp:object
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ] ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassified> ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ] [ sp:object <http://posccaesar.org/rdl/ERH00000> ;
                            sp:predicate <http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasClassifier> ;
                            sp:subject
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ]) ;
                sp:where ([ sp:object
                                    [ sp:varName "thisrduri"^^xsd:string
                                    ] ;
                            sp:predicate owl:sameAs ;
                            sp:subject spin:_this
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:generateUUID
                                    ] ;
                            sp:variable
                                    [ sp:varName "uuid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type fn:concat ;
                                      sp:arg1 "ERH" ;
                                      sp:arg2 [ sp:varName "uuid"^^xsd:string
                                              ]
                                    ] ;
                            sp:variable
                                    [ sp:varName "pcaid"^^xsd:string
                                    ]
                          ] [ rdf:type sp:Bind ;
                            sp:expression
                                    [ rdf:type spif:buildURI ;
                                      sp:arg1 "<http://posccaesar.org/rdl/{?pcaid}>"
                                    ] ;
                            sp:variable
                                    [ sp:varName "clsnuri"^^xsd:string
                                    ]
                          ])
              ] .