Completed
Push — master ( e6879a...ec92c9 )
by Enrico
03:43
created

AbstractAMLO::addIdentifier()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.8666
c 0
b 0
f 0
cc 3
nc 1
nop 5
crap 3
1
<?php
2
namespace AMLO\Model;
3
4
/*
5
 * Some helpers for AMLO ontology
6
 */
7
abstract class AbstractAMLO extends \BOTK\Model\AbstractModel
8
{
9
    
10
    protected static $DEFAULT_OPTIONS = [
11
        'ndg-registry-uri' => [ 
12
            'default'=> 'urn:resource:undefined-ndg-registry',
13
            'filter'=>FILTER_CALLBACK, 
14
            'options'=>'\BOTK\Filters::FILTER_VALIDATE_URI', 
15
            'flags'=> FILTER_REQUIRE_SCALAR
16
        ],
17
    ];
18
    
19
	protected static $VOCABULARY  = [
20
	   'fibo-fnd-dt-oc'    	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/DatesAndTimes/Occurrences/',
21
	   'fibo-fnd-pas-pas'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/ProductsAndServices/ProductsAndServices/',
22
	   'fibo-fnd-arr-rt'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Arrangements/Ratings/',
23
	   'fibo-fnd-arr-rep'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Arrangements/Reporting/',
24
	   'fibo-fnd-arr-doc'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Arrangements/Documents/',
25
	   'fibo-fnd-arr-asmt'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Arrangements/Assessments/',
26
	   'fibo-fnd-arr-id'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Arrangements/IdentifiersAndIndices/',
27
	   'fibo-fnd-acc-cur'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Accounting/CurrencyAmount/',
28
	   'fibo-fnd-qt-qtu'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Quantities/QuantitiesAndUnits/',
29
	   'fibo-fnd-acc-4217'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Accounting/ISO4217-CurrencyCodes/',
30
	   'fibo-fnd-rel-rel'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Relations/Relations/',
31
	   'fibo-fnd-aap-agt'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/AgentsAndPeople/Agents/',
32
	   'fibo-fnd-aap-ppl'   =>  'https://spec.edmcouncil.org/fibo/ontology/FND/AgentsAndPeople/People/',
33
	   'fibo-fnd-pty-pty'	=>  'https://spec.edmcouncil.org/fibo/ontology/FND/Parties/Parties/',
34
	   'fibo-be-oac-exec'	=>  'https://spec.edmcouncil.org/fibo/ontology/BE/OwnershipAndControl/Executives/',
35
	   'fibo-fbc-pas-caa'	=>  'https://spec.edmcouncil.org/fibo/ontology/FBC/ProductsAndServices/ClientsAndAccounts/',
36
	   'amlo' =>  'http://w3id.org/amlo/core#',
37
	];
38
	
39
	/**
40
	 * adds a FIBO idenfifier
41
	 */
42 1
	protected function addIdentifier($idenfiedURI, $type, $id, $registryURI=null, $idURI=null)
0 ignored issues
show
Unused Code introduced by
The parameter $idURI is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
	{
44 1
	    assert( !empty($type) && !empty($id) && !empty($idenfiedURI) );
45
	    
46 1
	    $subjectIdURI = $this->getURI($id, '') ;
47 1
	    $this->addFragment("<$subjectIdURI> fibo-fnd-rel-rel:hasTag \"%s\" ;", $id, false);
48 1
	    $this->addFragment(" fibo-fnd-aap-agt:identifies <%s> ;", $idenfiedURI, false );
49 1
	    $this->addFragment(" fibo-fnd-rel-rel:isDefinedIn <%s> ;", $registryURI ,false );
50 1
	    $this->addFragment(" a %s .", $type ,false);
51
	    
52 1
	    return $this;
53
	}
54
	
55
	/**
56
	* adds a party in role
57
	*/
58 1
	protected function addPartyInRole($subjectURI, $partyURI, $role)
59
	{
60 1
	    assert( !empty($subjectURI) && !empty($partyURI) && !empty($role) );
61
	    
62 1
	    $this->rdf .= "<$subjectURI> fibo-fnd-pty-pty:hasPartyInRole [ a $role ; fibo-fnd-rel-rel:hasIdentity <$partyURI> ] .";
63 1
	    $this->tripleCount += 3;
64
	    
65 1
	    return $this;
66
	}
67
}