Holger Knublauch
Committed by David Price

Additional helper function

...@@ -383,6 +383,43 @@ rhspin:ddrActivityStartDate ...@@ -383,6 +383,43 @@ rhspin:ddrActivityStartDate
383 ] ; 383 ] ;
384 spin:returnType xsd:date . 384 spin:returnType xsd:date .
385 385
386 +rhspin:ddrWellBoreId
387 + rdf:type spin:Function ;
388 + rdfs:comment "Gets the id of the well bore covered by a given DDR."^^xsd:string ;
389 + rdfs:label "DDR well bore id"^^xsd:string ;
390 + rdfs:subClassOf spin:Functions ;
391 + spin:body
392 + [ rdf:type sp:Select ;
393 + sp:resultVariables (_:b16) ;
394 + sp:where ([ rdf:type sp:TriplePath ;
395 + sp:object _:b17 ;
396 + sp:path [ rdf:type sp:SeqPath ;
397 + sp:path1
398 + [ rdf:type sp:SeqPath ;
399 + sp:path1 <http://www.reportinghub.no/ep/schema/activity#reportOn> ;
400 + sp:path2 <http://www.reportinghub.no/ep/schema/activity#onWellBore>
401 + ] ;
402 + sp:path2 <http://www.reportinghub.no/ep/schema/core#temporalPartOf>
403 + ] ;
404 + sp:subject
405 + [ sp:varName "ddr"^^xsd:string
406 + ]
407 + ] [ rdf:type sp:NamedGraph ;
408 + sp:elements ([ sp:object _:b16 ;
409 + sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
410 + sp:subject _:b17
411 + ]) ;
412 + sp:graphNameNode npdata:npd
413 + ])
414 + ] ;
415 + spin:constraint
416 + [ rdf:type spl:Argument ;
417 + rdfs:comment "The DailyDrillingReport to get the start date of."^^xsd:string ;
418 + spl:predicate <http://spinrdf.org/arg#ddr> ;
419 + spl:valueType <http://www.reportinghub.no/ep/schema/report#DailyDrillingReport>
420 + ] ;
421 + spin:returnType xsd:string .
422 +
386 rhspin:discoveryById 423 rhspin:discoveryById
387 rdf:type spin:Function ; 424 rdf:type spin:Function ;
388 rdfs:label "discovery by id"^^xsd:string ; 425 rdfs:label "discovery by id"^^xsd:string ;
...@@ -412,13 +449,13 @@ rhspin:dtypeValue ...@@ -412,13 +449,13 @@ rhspin:dtypeValue
412 rdfs:subClassOf spl:OntologyFunctions ; 449 rdfs:subClassOf spl:OntologyFunctions ;
413 spin:body 450 spin:body
414 [ rdf:type sp:Select ; 451 [ rdf:type sp:Select ;
415 - sp:resultVariables (_:b16) ; 452 + sp:resultVariables (_:b18) ;
416 - sp:where ([ sp:object _:b17 ; 453 + sp:where ([ sp:object _:b19 ;
417 sp:predicate spin:_arg2 ; 454 sp:predicate spin:_arg2 ;
418 sp:subject spin:_arg1 455 sp:subject spin:_arg1
419 - ] [ sp:object _:b16 ; 456 + ] [ sp:object _:b18 ;
420 sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ; 457 sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
421 - sp:subject _:b17 458 + sp:subject _:b19
422 ]) 459 ])
423 ] ; 460 ] ;
424 spin:constraint 461 spin:constraint
...@@ -508,9 +545,9 @@ rhspin:licenceForWellBore ...@@ -508,9 +545,9 @@ rhspin:licenceForWellBore
508 rdfs:subClassOf spin:Functions ; 545 rdfs:subClassOf spin:Functions ;
509 spin:body 546 spin:body
510 [ rdf:type sp:Select ; 547 [ rdf:type sp:Select ;
511 - sp:resultVariables (_:b18) ; 548 + sp:resultVariables (_:b20) ;
512 sp:where ([ rdf:type sp:NamedGraph ; 549 sp:where ([ rdf:type sp:NamedGraph ;
513 - sp:elements ([ sp:object _:b18 ; 550 + sp:elements ([ sp:object _:b20 ;
514 sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ; 551 sp:predicate <http://www.reportinghub.no/np/schema/npd#drilledInProductionLicence> ;
515 sp:subject 552 sp:subject
516 [ sp:varName "wellBore"^^xsd:string 553 [ sp:varName "wellBore"^^xsd:string
...@@ -534,7 +571,7 @@ rhspin:normalizeString ...@@ -534,7 +571,7 @@ rhspin:normalizeString
534 rdfs:subClassOf spl:StringFunctions ; 571 rdfs:subClassOf spl:StringFunctions ;
535 spin:body 572 spin:body
536 [ rdf:type sp:Select ; 573 [ rdf:type sp:Select ;
537 - sp:resultVariables (_:b19) ; 574 + sp:resultVariables (_:b21) ;
538 sp:where ([ rdf:type sp:Bind ; 575 sp:where ([ rdf:type sp:Bind ;
539 sp:expression 576 sp:expression
540 [ rdf:type spif:regex ; 577 [ rdf:type spif:regex ;
...@@ -542,67 +579,67 @@ rhspin:normalizeString ...@@ -542,67 +579,67 @@ rhspin:normalizeString
542 sp:arg2 "\\((.*)\\)" ; 579 sp:arg2 "\\((.*)\\)" ;
543 sp:arg3 "" 580 sp:arg3 ""
544 ] ; 581 ] ;
545 - sp:variable _:b20 582 + sp:variable _:b22
546 ] [ rdf:type sp:Bind ; 583 ] [ rdf:type sp:Bind ;
547 sp:expression 584 sp:expression
548 [ rdf:type spif:trim ; 585 [ rdf:type spif:trim ;
549 - sp:arg1 _:b20 586 + sp:arg1 _:b22
550 ] ; 587 ] ;
551 - sp:variable _:b21 588 + sp:variable _:b23
552 ] [ rdf:type sp:Bind ; 589 ] [ rdf:type sp:Bind ;
553 sp:expression 590 sp:expression
554 [ rdf:type spif:encodeURL ; 591 [ rdf:type spif:encodeURL ;
555 - sp:arg1 _:b21 592 + sp:arg1 _:b23
556 ] ; 593 ] ;
557 - sp:variable _:b22 594 + sp:variable _:b24
558 ] [ rdf:type sp:Bind ; 595 ] [ rdf:type sp:Bind ;
559 sp:expression 596 sp:expression
560 [ rdf:type spif:regex ; 597 [ rdf:type spif:regex ;
561 - sp:arg1 _:b22 ; 598 + sp:arg1 _:b24 ;
562 sp:arg2 "%2F" ; 599 sp:arg2 "%2F" ;
563 sp:arg3 "_" 600 sp:arg3 "_"
564 ] ; 601 ] ;
565 - sp:variable _:b23 602 + sp:variable _:b25
566 ] [ rdf:type sp:Bind ; 603 ] [ rdf:type sp:Bind ;
567 sp:expression 604 sp:expression
568 [ rdf:type spif:regex ; 605 [ rdf:type spif:regex ;
569 - sp:arg1 _:b23 ; 606 + sp:arg1 _:b25 ;
570 sp:arg2 "%[0-9A-F][0-9A-F]" ; 607 sp:arg2 "%[0-9A-F][0-9A-F]" ;
571 sp:arg3 "" 608 sp:arg3 ""
572 ] ; 609 ] ;
573 - sp:variable _:b24 610 + sp:variable _:b26
574 ] [ rdf:type sp:Bind ; 611 ] [ rdf:type sp:Bind ;
575 sp:expression 612 sp:expression
576 [ rdf:type spif:regex ; 613 [ rdf:type spif:regex ;
577 - sp:arg1 _:b24 ; 614 + sp:arg1 _:b26 ;
578 sp:arg2 "\\+" ; 615 sp:arg2 "\\+" ;
579 sp:arg3 "_" 616 sp:arg3 "_"
580 ] ; 617 ] ;
581 - sp:variable _:b25 618 + sp:variable _:b27
582 ] [ rdf:type sp:Bind ; 619 ] [ rdf:type sp:Bind ;
583 sp:expression 620 sp:expression
584 [ rdf:type spif:regex ; 621 [ rdf:type spif:regex ;
585 - sp:arg1 _:b25 ; 622 + sp:arg1 _:b27 ;
586 sp:arg2 "_+" ; 623 sp:arg2 "_+" ;
587 sp:arg3 "_" 624 sp:arg3 "_"
588 ] ; 625 ] ;
589 - sp:variable _:b26 626 + sp:variable _:b28
590 ] [ rdf:type sp:Bind ; 627 ] [ rdf:type sp:Bind ;
591 sp:expression 628 sp:expression
592 [ rdf:type spif:regex ; 629 [ rdf:type spif:regex ;
593 - sp:arg1 _:b26 ; 630 + sp:arg1 _:b28 ;
594 sp:arg2 "\\*" ; 631 sp:arg2 "\\*" ;
595 sp:arg3 "" 632 sp:arg3 ""
596 ] ; 633 ] ;
597 - sp:variable _:b27 634 + sp:variable _:b29
598 ] [ rdf:type sp:Bind ; 635 ] [ rdf:type sp:Bind ;
599 sp:expression 636 sp:expression
600 [ rdf:type xsd:string ; 637 [ rdf:type xsd:string ;
601 sp:arg1 [ rdf:type spif:upperCase ; 638 sp:arg1 [ rdf:type spif:upperCase ;
602 - sp:arg1 _:b27 639 + sp:arg1 _:b29
603 ] 640 ]
604 ] ; 641 ] ;
605 - sp:variable _:b19 642 + sp:variable _:b21
606 ]) 643 ])
607 ] ; 644 ] ;
608 spin:constraint 645 spin:constraint
...@@ -619,9 +656,9 @@ rhspin:npdId ...@@ -619,9 +656,9 @@ rhspin:npdId
619 rdfs:subClassOf spl:StringFunctions ; 656 rdfs:subClassOf spl:StringFunctions ;
620 spin:body 657 spin:body
621 [ rdf:type sp:Select ; 658 [ rdf:type sp:Select ;
622 - sp:resultVariables (_:b28) ; 659 + sp:resultVariables (_:b30) ;
623 sp:where ([ rdf:type sp:NamedGraph ; 660 sp:where ([ rdf:type sp:NamedGraph ;
624 - sp:elements ([ sp:object _:b28 ; 661 + sp:elements ([ sp:object _:b30 ;
625 sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ; 662 sp:predicate <http://www.reportinghub.no/np/schema/npd#id> ;
626 sp:subject 663 sp:subject
627 [ sp:varName "resource"^^xsd:string 664 [ sp:varName "resource"^^xsd:string
...@@ -644,9 +681,9 @@ rhspin:npdName ...@@ -644,9 +681,9 @@ rhspin:npdName
644 rdfs:subClassOf spl:StringFunctions ; 681 rdfs:subClassOf spl:StringFunctions ;
645 spin:body 682 spin:body
646 [ rdf:type sp:Select ; 683 [ rdf:type sp:Select ;
647 - sp:resultVariables (_:b29) ; 684 + sp:resultVariables (_:b31) ;
648 sp:where ([ rdf:type sp:NamedGraph ; 685 sp:where ([ rdf:type sp:NamedGraph ;
649 - sp:elements ([ sp:object _:b29 ; 686 + sp:elements ([ sp:object _:b31 ;
650 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; 687 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
651 sp:subject 688 sp:subject
652 [ sp:varName "resource"^^xsd:string 689 [ sp:varName "resource"^^xsd:string
...@@ -758,27 +795,27 @@ rhspin:wellBoreByName ...@@ -758,27 +795,27 @@ rhspin:wellBoreByName
758 rdfs:subClassOf spl:URIFunctions ; 795 rdfs:subClassOf spl:URIFunctions ;
759 spin:body 796 spin:body
760 [ rdf:type sp:Select ; 797 [ rdf:type sp:Select ;
761 - sp:resultVariables (_:b30) ; 798 + sp:resultVariables (_:b32) ;
762 sp:where ([ rdf:type sp:NamedGraph ; 799 sp:where ([ rdf:type sp:NamedGraph ;
763 sp:elements ([ rdf:type sp:Union ; 800 sp:elements ([ rdf:type sp:Union ;
764 - sp:elements (([ sp:object _:b31 ; 801 + sp:elements (([ sp:object _:b33 ;
765 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; 802 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
766 - sp:subject _:b30 803 + sp:subject _:b32
767 ]) ([ rdf:type sp:Bind ; 804 ]) ([ rdf:type sp:Bind ;
768 sp:expression 805 sp:expression
769 [ rdf:type spif:replaceAll ; 806 [ rdf:type spif:replaceAll ;
770 - sp:arg1 _:b31 ; 807 + sp:arg1 _:b33 ;
771 sp:arg2 "/0" ; 808 sp:arg2 "/0" ;
772 sp:arg3 "/" 809 sp:arg3 "/"
773 ] ; 810 ] ;
774 - sp:variable _:b32 811 + sp:variable _:b34
775 - ] [ sp:object _:b32 ; 812 + ] [ sp:object _:b34 ;
776 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ; 813 sp:predicate <http://www.reportinghub.no/np/schema/npd#name> ;
777 - sp:subject _:b30 814 + sp:subject _:b32
778 ])) 815 ]))
779 ] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ; 816 ] [ sp:object <http://www.reportinghub.no/ep/schema/well#WellBore> ;
780 sp:predicate rdf:type ; 817 sp:predicate rdf:type ;
781 - sp:subject _:b30 818 + sp:subject _:b32
782 ]) ; 819 ]) ;
783 sp:graphNameNode npdata:npd 820 sp:graphNameNode npdata:npd
784 ]) 821 ])
...@@ -817,58 +854,64 @@ rhspin:wellByName ...@@ -817,58 +854,64 @@ rhspin:wellByName
817 ] ; 854 ] ;
818 spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> . 855 spin:returnType <http://www.reportinghub.no/ep/schema/well#Well> .
819 856
857 +_:b16
858 + sp:varName "id"^^xsd:string .
859 +
860 +_:b17
861 + sp:varName "wellBore"^^xsd:string .
862 +
820 _:b15 863 _:b15
821 sp:varName "startedAt"^^xsd:string . 864 sp:varName "startedAt"^^xsd:string .
822 865
823 -_:b32 866 +_:b34
824 sp:varName "str"^^xsd:string . 867 sp:varName "str"^^xsd:string .
825 868
826 -_:b31 869 +_:b33
827 sp:varName "wellBoreName"^^xsd:string . 870 sp:varName "wellBoreName"^^xsd:string .
828 871
829 -_:b30 872 +_:b32
830 sp:varName "wellBore"^^xsd:string . 873 sp:varName "wellBore"^^xsd:string .
831 874
832 -_:b29 875 +_:b31
833 sp:varName "name"^^xsd:string . 876 sp:varName "name"^^xsd:string .
834 877
835 -_:b28 878 +_:b30
836 sp:varName "id"^^xsd:string . 879 sp:varName "id"^^xsd:string .
837 880
838 -_:b27 881 +_:b29
839 sp:varName "t4"^^xsd:string . 882 sp:varName "t4"^^xsd:string .
840 883
841 -_:b26 884 +_:b28
842 sp:varName "t3"^^xsd:string . 885 sp:varName "t3"^^xsd:string .
843 886
844 -_:b25 887 +_:b27
845 sp:varName "t2"^^xsd:string . 888 sp:varName "t2"^^xsd:string .
846 889
847 -_:b24 890 +_:b26
848 sp:varName "t1"^^xsd:string . 891 sp:varName "t1"^^xsd:string .
849 892
850 -_:b23 893 +_:b25
851 sp:varName "t0b"^^xsd:string . 894 sp:varName "t0b"^^xsd:string .
852 895
853 -_:b22 896 +_:b24
854 sp:varName "t0a"^^xsd:string . 897 sp:varName "t0a"^^xsd:string .
855 898
856 -_:b21 899 +_:b23
857 sp:varName "s2"^^xsd:string . 900 sp:varName "s2"^^xsd:string .
858 901
859 -_:b20 902 +_:b22
860 sp:varName "s1"^^xsd:string . 903 sp:varName "s1"^^xsd:string .
861 904
862 -_:b19 905 +_:b21
863 sp:varName "normalizedStr"^^xsd:string . 906 sp:varName "normalizedStr"^^xsd:string .
864 907
865 -_:b18 908 +_:b20
866 sp:varName "licence"^^xsd:string . 909 sp:varName "licence"^^xsd:string .
867 910
868 -_:b17 911 +_:b19
869 sp:varName "reif"^^xsd:string . 912 sp:varName "reif"^^xsd:string .
870 913
871 -_:b16 914 +_:b18
872 sp:varName "value"^^xsd:string . 915 sp:varName "value"^^xsd:string .
873 916
874 _:b14 917 _:b14
......