Fixed well/bore constraints
Added constraints for licence checking Removed header (moved to Sources project)
Showing
4 changed files
with
146 additions
and
40 deletions
This diff is collapsed. Click to expand it.
1 | +# baseURI: http://www.reportinghub.no/ep/spin/report-constraints | ||
2 | +# imports: http://spinrdf.org/spin | ||
3 | +# imports: http://www.reportinghub.no/ep/schema/1.0/activity | ||
4 | +# imports: http://www.reportinghub.no/ep/schema/1.0/core | ||
5 | +# imports: http://www.reportinghub.no/ep/schema/1.0/ddr | ||
6 | +# imports: http://www.reportinghub.no/ep/schema/1.0/equipment | ||
7 | +# imports: http://www.reportinghub.no/ep/schema/1.0/facility | ||
8 | +# imports: http://www.reportinghub.no/ep/schema/1.0/organization | ||
9 | +# imports: http://www.reportinghub.no/ep/schema/1.0/report | ||
10 | +# imports: http://www.reportinghub.no/ep/schema/1.0/well | ||
11 | +# imports: http://www.reportinghub.no/np/schema/1.0/npd | ||
12 | +# imports: http://www.reportinghub.no/spin/rh | ||
13 | + | ||
14 | +@prefix : <http://www.reportinghub.no/ep/spin/report-constraints#> . | ||
15 | +@prefix arg: <http://spinrdf.org/arg#> . | ||
16 | +@prefix ddr: <http://www.reportinghub.no/ep/schema/ddr#> . | ||
17 | +@prefix fn: <http://www.w3.org/2005/xpath-functions#> . | ||
18 | +@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
19 | +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
20 | +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
21 | +@prefix rhspin: <http://www.reportinghub.no/spin/rh#> . | ||
22 | +@prefix sp: <http://spinrdf.org/sp#> . | ||
23 | +@prefix spin: <http://spinrdf.org/spin#> . | ||
24 | +@prefix spl: <http://spinrdf.org/spl#> . | ||
25 | +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
26 | + | ||
27 | +<http://www.reportinghub.no/ep/schema/report#DailyDrillingReport> | ||
28 | + spin:constraint | ||
29 | + [ rdf:type sp:Construct ; | ||
30 | + sp:templates ([ sp:object spin:ConstraintViolation ; | ||
31 | + sp:predicate rdf:type ; | ||
32 | + sp:subject _:b1 | ||
33 | + ] [ sp:object spin:_this ; | ||
34 | + sp:predicate spin:violationRoot ; | ||
35 | + sp:subject _:b1 | ||
36 | + ] [ sp:object _:b2 ; | ||
37 | + sp:predicate rdfs:label ; | ||
38 | + sp:subject _:b1 | ||
39 | + ]) ; | ||
40 | + sp:where ([ rdf:type sp:TriplePath ; | ||
41 | + sp:object _:b3 ; | ||
42 | + sp:path [ rdf:type sp:SeqPath ; | ||
43 | + sp:path1 | ||
44 | + [ rdf:type sp:SeqPath ; | ||
45 | + sp:path1 <http://www.reportinghub.no/ep/schema/activity#reportOn> ; | ||
46 | + sp:path2 <http://www.reportinghub.no/ep/schema/activity#onWellBore> | ||
47 | + ] ; | ||
48 | + sp:path2 <http://www.reportinghub.no/ep/schema/core#temporalPartOf> | ||
49 | + ] ; | ||
50 | + sp:subject spin:_this | ||
51 | + ] [ rdf:type sp:Bind ; | ||
52 | + sp:expression | ||
53 | + [ rdf:type rhspin:companyName | ||
54 | + ] ; | ||
55 | + sp:variable _:b4 | ||
56 | + ] [ rdf:type sp:Bind ; | ||
57 | + sp:expression | ||
58 | + [ rdf:type rhspin:companyWithName ; | ||
59 | + arg:name _:b4 | ||
60 | + ] ; | ||
61 | + sp:variable _:b5 | ||
62 | + ] [ rdf:type sp:Filter ; | ||
63 | + sp:expression | ||
64 | + [ rdf:type sp:bound ; | ||
65 | + sp:arg1 _:b5 | ||
66 | + ] | ||
67 | + ] [ rdf:type sp:NotExists ; | ||
68 | + sp:elements ([ sp:object _:b3 ; | ||
69 | + sp:predicate rhspin:companyHasLicenceForWellBore ; | ||
70 | + sp:subject _:b5 | ||
71 | + ]) | ||
72 | + ] [ rdf:type sp:Bind ; | ||
73 | + sp:expression | ||
74 | + [ rdf:type fn:concat ; | ||
75 | + sp:arg1 "Your company (" ; | ||
76 | + sp:arg2 _:b4 ; | ||
77 | + sp:arg3 ") does not hold a licence for well bore " ; | ||
78 | + sp:arg4 [ rdf:type rhspin:npdName ; | ||
79 | + arg:resource _:b3 | ||
80 | + ] | ||
81 | + ] ; | ||
82 | + sp:variable _:b2 | ||
83 | + ]) | ||
84 | + ] . | ||
85 | + | ||
86 | +<http://www.reportinghub.no/ep/spin/report-constraints> | ||
87 | + rdf:type owl:Ontology ; | ||
88 | + rdfs:comment "Constraints that need to be executed after ep-report:Report generation (without SXML triples)."^^xsd:string ; | ||
89 | + owl:imports <http://www.reportinghub.no/spin/rh> , <http://spinrdf.org/spin> , <http://www.reportinghub.no/ep/schema/1.0/report> , <http://www.reportinghub.no/ep/schema/1.0/facility> , <http://www.reportinghub.no/np/schema/1.0/npd> , <http://www.reportinghub.no/ep/schema/1.0/organization> , <http://www.reportinghub.no/ep/schema/1.0/core> , <http://www.reportinghub.no/ep/schema/1.0/well> , <http://www.reportinghub.no/ep/schema/1.0/equipment> , <http://www.reportinghub.no/ep/schema/1.0/activity> , <http://www.reportinghub.no/ep/schema/1.0/ddr> ; | ||
90 | + owl:versionInfo "0.1.0"^^xsd:string . | ||
91 | + | ||
92 | +_:b2 sp:varName "message"^^xsd:string . | ||
93 | + | ||
94 | +_:b3 sp:varName "wellBore"^^xsd:string . | ||
95 | + | ||
96 | +_:b4 sp:varName "companyName"^^xsd:string . | ||
97 | + | ||
98 | +_:b5 sp:varName "company"^^xsd:string . |
... | @@ -700,6 +700,40 @@ rhspin:npdName | ... | @@ -700,6 +700,40 @@ rhspin:npdName |
700 | ] ; | 700 | ] ; |
701 | spin:returnType xsd:string . | 701 | spin:returnType xsd:string . |
702 | 702 | ||
703 | +rhspin:npdTripleExists | ||
704 | + rdf:type spin:Function ; | ||
705 | + rdfs:comment "Checks whether the NPD graph contains a given triple (?arg1, ?arg2, ?arg3)."^^xsd:string ; | ||
706 | + rdfs:label "NPD triple exists"^^xsd:string ; | ||
707 | + rdfs:subClassOf spin:Functions ; | ||
708 | + spin:body | ||
709 | + [ rdf:type sp:Ask ; | ||
710 | + sp:where ([ rdf:type sp:NamedGraph ; | ||
711 | + sp:elements ([ sp:object spin:_arg3 ; | ||
712 | + sp:predicate spin:_arg2 ; | ||
713 | + sp:subject spin:_arg1 | ||
714 | + ]) ; | ||
715 | + sp:graphNameNode npdata:npd | ||
716 | + ]) | ||
717 | + ] ; | ||
718 | + spin:constraint | ||
719 | + [ rdf:type spl:Argument ; | ||
720 | + rdfs:comment "The object to match."^^xsd:string ; | ||
721 | + spl:predicate sp:arg3 | ||
722 | + ] ; | ||
723 | + spin:constraint | ||
724 | + [ rdf:type spl:Argument ; | ||
725 | + rdfs:comment "The predicate to match."^^xsd:string ; | ||
726 | + spl:predicate sp:arg2 ; | ||
727 | + spl:valueType rdf:Property | ||
728 | + ] ; | ||
729 | + spin:constraint | ||
730 | + [ rdf:type spl:Argument ; | ||
731 | + rdfs:comment "The subject to find"^^xsd:string ; | ||
732 | + spl:predicate sp:arg1 ; | ||
733 | + spl:valueType rdfs:Resource | ||
734 | + ] ; | ||
735 | + spin:returnType xsd:boolean . | ||
736 | + | ||
703 | rhspin:parentCompanyByName | 737 | rhspin:parentCompanyByName |
704 | rdf:type spin:Function ; | 738 | rdf:type spin:Function ; |
705 | rdfs:comment "Gets the URI resource of a parent company based on its NPD name."^^xsd:string ; | 739 | rdfs:comment "Gets the URI resource of a parent company based on its NPD name."^^xsd:string ; |
... | @@ -797,22 +831,11 @@ rhspin:wellBoreByName | ... | @@ -797,22 +831,11 @@ rhspin:wellBoreByName |
797 | [ rdf:type sp:Select ; | 831 | [ rdf:type sp:Select ; |
798 | sp:resultVariables (_:b32) ; | 832 | sp:resultVariables (_:b32) ; |
799 | sp:where ([ rdf:type sp:NamedGraph ; | 833 | sp:where ([ rdf:type sp:NamedGraph ; |
800 | - sp:elements ([ rdf:type sp:Union ; | 834 | + sp:elements ([ sp:object |
801 | - sp:elements (([ sp:object _:b33 ; | 835 | + [ sp:varName "wellBoreName"^^xsd:string |
802 | - sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; | 836 | + ] ; |
803 | - sp:subject _:b32 | 837 | + sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; |
804 | - ]) ([ rdf:type sp:Bind ; | 838 | + sp:subject _:b32 |
805 | - sp:expression | ||
806 | - [ rdf:type spif:replaceAll ; | ||
807 | - sp:arg1 _:b33 ; | ||
808 | - sp:arg2 "/0" ; | ||
809 | - sp:arg3 "/" | ||
810 | - ] ; | ||
811 | - sp:variable _:b34 | ||
812 | - ] [ sp:object _:b34 ; | ||
813 | - sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; | ||
814 | - sp:subject _:b32 | ||
815 | - ])) | ||
816 | ] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ; | 839 | ] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ; |
817 | sp:predicate rdf:type ; | 840 | sp:predicate rdf:type ; |
818 | sp:subject _:b32 | 841 | sp:subject _:b32 |
... | @@ -854,21 +877,6 @@ rhspin:wellByName | ... | @@ -854,21 +877,6 @@ rhspin:wellByName |
854 | ] ; | 877 | ] ; |
855 | spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> . | 878 | spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> . |
856 | 879 | ||
857 | -_:b16 | ||
858 | - sp:varName "id"^^xsd:string . | ||
859 | - | ||
860 | -_:b17 | ||
861 | - sp:varName "wellBore"^^xsd:string . | ||
862 | - | ||
863 | -_:b15 | ||
864 | - sp:varName "startedAt"^^xsd:string . | ||
865 | - | ||
866 | -_:b34 | ||
867 | - sp:varName "str"^^xsd:string . | ||
868 | - | ||
869 | -_:b33 | ||
870 | - sp:varName "wellBoreName"^^xsd:string . | ||
871 | - | ||
872 | _:b32 | 880 | _:b32 |
873 | sp:varName "wellBore"^^xsd:string . | 881 | sp:varName "wellBore"^^xsd:string . |
874 | 882 | ||
... | @@ -914,6 +922,15 @@ _:b19 | ... | @@ -914,6 +922,15 @@ _:b19 |
914 | _:b18 | 922 | _:b18 |
915 | sp:varName "value"^^xsd:string . | 923 | sp:varName "value"^^xsd:string . |
916 | 924 | ||
925 | +_:b17 | ||
926 | + sp:varName "wellBore"^^xsd:string . | ||
927 | + | ||
928 | +_:b16 | ||
929 | + sp:varName "id"^^xsd:string . | ||
930 | + | ||
931 | +_:b15 | ||
932 | + sp:varName "startedAt"^^xsd:string . | ||
933 | + | ||
917 | _:b14 | 934 | _:b14 |
918 | sp:varName "company"^^xsd:string . | 935 | sp:varName "company"^^xsd:string . |
919 | 936 | ... | ... |
1 | -<ui:group> | ||
2 | - <div> </div> | ||
3 | - <div class="logoContainer"><a href="http://www.epim.no" target="_new"><img src="lib/rh/images/logoEpim.gif" width="201" height="106" align="right" title="EPIM" /></a> | ||
4 | - <div style="padding: 10px"> | ||
5 | - <h1>ReportingHub</h1> | ||
6 | - <div>You are logged in as: <b>{= rhspin:userName() }</b></div> | ||
7 | - </div> | ||
8 | - </div> | ||
9 | -</ui:group> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment