Skip to content

Commit

Permalink
Merge pull request #60 from NRGI/tag-lifter-blank-ids
Browse files Browse the repository at this point in the history
Tag lifter blank ids
  • Loading branch information
Bjwebb committed Oct 21, 2015
2 parents bfaf7a5 + d933e07 commit 6120db2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 56 deletions.
5 changes: 4 additions & 1 deletion modules/taglifter.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ def generate_identifier(self,row,path,entity_type,country = "xx",lang="en"):
pattern = pattern.replace("{suffix}",''.join(random.choice('0123456789abcdefghijklmnopqrstuvwxyz') for i in range(6)))

if "{cleanstring}" in pattern:
pattern = pattern.replace("{cleanstring}",self.clean_string(row[path]).strip())
if len(row[path].strip()) > 0:
pattern = pattern.replace("{cleanstring}",self.clean_string(row[path]).strip())
else:
pattern = pattern.replace("{cleanstring}",random_string())

identifier = pattern

Expand Down
116 changes: 61 additions & 55 deletions ontology/resource-projects-ontology.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,8 @@ Government owned companies are still represented using Company.
<rdfs:subClassOf rdf:resource="http://resourceprojects.org/def/Transaction"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payee"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/GovernmentParty"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand All @@ -725,8 +725,14 @@ Government owned companies are still represented using Company.
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payee"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/GovernmentParty"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payer"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand All @@ -747,12 +753,6 @@ Government owned companies are still represented using Company.
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payer"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
<rdfs:comment xml:lang="en">Payments made by a company to the government, including:

Expand All @@ -771,6 +771,12 @@ Payment to governments: Payments to governments are amounts paid, whether in mon

<owl:Class rdf:about="http://resourceprojects.org/def/Concession">
<rdfs:label xml:lang="en">Concession</rdfs:label>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/relatedProject"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Project"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
Expand All @@ -790,8 +796,8 @@ Payment to governments: Payments to governments are amounts paid, whether in mon
<rdfs:label xml:lang="en">Contract (resource contract)</rdfs:label>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasStake"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Stake"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/relatedProject"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Project"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand Down Expand Up @@ -842,14 +848,8 @@ In ResourceProjects.org one or more contracts may be associated with a project:
<rdfs:subClassOf rdf:resource="http://resourceprojects.org/def/Transaction"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/relatedLineItem"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/ReportLineItem"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payer"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand All @@ -864,6 +864,12 @@ In ResourceProjects.org one or more contracts may be associated with a project:
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/relatedLineItem"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/ReportLineItem"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payee"/>
Expand All @@ -878,8 +884,8 @@ In ResourceProjects.org one or more contracts may be associated with a project:
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/payer"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
Expand Down Expand Up @@ -918,14 +924,14 @@ Where several layers of ownership exist, the name of the ultimate parent entity
<rdfs:label>Group membership</rdfs:label>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/organisation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/organisation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Company"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
Expand Down Expand Up @@ -1028,18 +1034,6 @@ GroupMemberships can have additional properties to indicate the nature of the me

<owl:Class rdf:about="http://resourceprojects.org/def/Project">
<rdfs:label xml:lang="en">Project</rdfs:label>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Location"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasCommodity"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Commodity"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
Expand All @@ -1064,10 +1058,22 @@ GroupMemberships can have additional properties to indicate the nature of the me
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Production"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasCommodity"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Commodity"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Country"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Location"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Site"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand All @@ -1079,7 +1085,7 @@ GroupMemberships can have additional properties to indicate the nature of the me
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Site"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Country"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
Expand Down Expand Up @@ -1137,8 +1143,8 @@ Definitions used around the world still differ somewhat but there is increasing
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasCommodity"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Commodity"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Location"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand All @@ -1149,14 +1155,14 @@ Definitions used around the world still differ somewhat but there is increasing
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Country"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasCommodity"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Commodity"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasLocation"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Location"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Country"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
Expand Down Expand Up @@ -1211,20 +1217,20 @@ ResourceProjects.org records point coordinates (in lat-long format) identifying
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasStakeholder"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Organization"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/isStakeIn"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Site"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/hasStakeholder"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Organization"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/isStakeIn"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Site"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
Expand Down Expand Up @@ -1285,14 +1291,14 @@ A stake may relate to a company, project, license or contract. </rdfs:comment>
<owl:Class rdf:about="http://resourceprojects.org/def/Transaction">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/paymentType"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/PaymentType"/>
<owl:onProperty rdf:resource="http://resourceprojects.org/def/source"/>
<owl:someValuesFrom rdf:resource="http://resourceprojects.org/def/Source"/>
</owl:Restriction>
</rdfs:subClassOf>
<captureProvenance rdf:datatype="&xsd;boolean">true</captureProvenance>
Expand Down

0 comments on commit 6120db2

Please sign in to comment.