From 40b60d13d0c5da78d31e0fb13ebee45d5bf95a3e Mon Sep 17 00:00:00 2001 From: timgdavies Date: Sat, 24 Oct 2015 13:41:30 -0500 Subject: [PATCH 1/3] Updating ontology for contract and project linkage --- modules/TagLifter.md | 214 ++++++++++++++++++++++++ ontology/resource-projects-ontology.rdf | 134 +++++++-------- 2 files changed, 278 insertions(+), 70 deletions(-) create mode 100644 modules/TagLifter.md diff --git a/modules/TagLifter.md b/modules/TagLifter.md new file mode 100644 index 0000000..b2ed045 --- /dev/null +++ b/modules/TagLifter.md @@ -0,0 +1,214 @@ +# TagLifter + +Tag Lifter takes a spreadsheet of data, marked up with #tag headings for columns, and converts this to a Linked Data graph based on an ontology. + +Tags may take the following forms: + +| N | Tag | Interpretation | +|---|-----|----------------| +| 1 | #class | Create a new entity with the value of this column as skos:PrefLabel | +| 2 | #class+**identifier** | Use the value of this column as the identifier of any #class in this row | +| 3 | #class+dataProperty | Use the value of this column as the literal value of the data property of the class entity | +| 4 | #class+class | Look for a **direct** relationship between the two classes (in either direction **NOT CURRENTLY IMPLEMENTED**), and assert the objectProperty between the two classes. If no direct relationship exists, look for an intermediate step and establish this relationship instead. | +| 5 | #class+class+dataProperty | See if the dataProperty can attach to the second class and if so, attach it. If not, see if there was an intermediate entity created to join the two classes, and if the dataProperty can attach to this, add it here. | + +In addition, tags may include: + +**+n** to distinguish two instances of the same class or data property in the same row. For example, #project+1 and #project+2 + +**+en** or any other two-digit country code to indicate the language that should be applied to any string literals created for that column. + +To parse spreadsheets Tag Lifter will: + +- Read left-to-right across each row; +- Whenever it encounters a new class, check to see if any subsequent column contains a name and identifier for this; +- Check for relationships between any classes at the same level of the tag hierarchy; +- Cache identifiers for entities; + +When reading a multiple tabbed spreadsheet, TagLifter will cache the identifiers for any named entity. For example, once it has established an identifier for a #project named 'Jubilee', it will use this identifier on future sheets for rows containing a #project column where the cell contains 'Jubilee', even if no #project+identifier column is present. + + +## Examples + +### #Class + +Input: + +| #project | +|----------| +| Jubilee Fields | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en. +``` + +The ```identifierPattern``` property of each class in the ontology is used to determine how identifiers should be generated if no +identifier column is present. + +### #class+identifier + +Identifier is a reserved keyword. + +Input: + +| #project | #project+identifier | +|----------|---------------------| +| Jubilee Fields | gh/jufi-asd24f | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en. +``` + +### #class+dataProperty + +Input: + +| #source | #source+identifier | #source+url +|----------|---------------------| +| Projects Report | | http://www.example.com/project-report | + +Output: + +``` + a base:Source; + skos:prefLabel "Projects Report"@en; + base:url "http://www.example.com/project-report". +``` + +### #class+class + +#### Direct relationship + +Where the ontology allows a direct relationship between the two classes, such as: + +``` base:relatedContract ``` + +Input: + +| #project | #project+identifier | #project+contract | +|----------|---------------------|-------------------| +| Jubilee Fields | gh/jufi-asd24f | Jubilee Contract | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en; + base:relatedContract . + + a base:Contract; + skos:prefLabel "Jubilee Contract"@en. +``` + +#### Indirect relationship + +Where an intermediate entity sits between the two classes, such as: + +``` hasStake hasStakeholder ``` + +Input: + +| #project | #project+identifier | #project+company | #project+company+identifier | +|----------|---------------------|-------------------|----------------------------| +| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en; + base:hasStake . + + a base:Stake; + base:hasStakeholder . + + a base:Company; + skos:prefLabel "Tullow Oil"@en. +``` + + +### #class+class+dataProperty + +#### Direct relationship + +Where the ontology allows a direct relationship between the two classes, such as: + +``` base:source ``` + +Input: + +| #project | #project+identifier | #project+source | #project+source+url | +|----------|---------------------|-------------------|----------------------------| +| Jubilee Fields | gh/jufi-asd24f | Project Report | http://www.example.com/project-report | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en; + base:source . + + a base:Source; + skos:prefLabel "Projects Report"@en; + base:url "http://www.example.com/project-report". +``` + +#### Indirect relationship + +Where an intermediate entity sits between the two classes, such as: + +``` hasStake hasStakeholder ``` + +and the property attaches to the intermediate entity. + +Input: + +| #project | #project+identifier | #project+company | #project+company+identifier | #project+company+share | +|----------|---------------------|-------------------|----------------------------|------------------------| +| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | 10 | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en; + base:hasStake . + + a base:Stake; + base:hasStakeholder ; + base:share 10. + + a base:Company; + skos:prefLabel "Tullow Oil"@en. +``` + + +### #class and #class + +Where two classes are next to each other, and then can be related, establish the relationship. + +Input: + +| #project | #project+identifier | #company | #company+identifier | +|----------|---------------------|----------|---------------------| +| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | + +Output: + +``` + a base:Project; + skos:prefLabel "Jubilee Fields"@en; + base:hasStake . + + a base:Stake; + base:hasStakeholder . + + a base:Company; + skos:prefLabel "Tullow Oil"@en. +``` + diff --git a/ontology/resource-projects-ontology.rdf b/ontology/resource-projects-ontology.rdf index e6528ba..db98799 100644 --- a/ontology/resource-projects-ontology.rdf +++ b/ontology/resource-projects-ontology.rdf @@ -713,26 +713,26 @@ Government owned companies are still represented using Company. - - + + - - + + - - + + - - + + @@ -749,8 +749,8 @@ Government owned companies are still represented using Company. - - + + true @@ -773,14 +773,14 @@ Payment to governments: Payments to governments are amounts paid, whether in mon Concession - - + + - - + + true @@ -848,14 +848,14 @@ In ResourceProjects.org one or more contracts may be associated with a project: - - + + - - + + @@ -866,26 +866,26 @@ In ResourceProjects.org one or more contracts may be associated with a project: - - + + - - + + - - + + - - + + true @@ -924,14 +924,14 @@ Where several layers of ownership exist, the name of the ultimate parent entity Group membership - - + + - - + + true @@ -1042,56 +1042,56 @@ GroupMemberships can have additional properties to indicate the nature of the me Project - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + true @@ -1124,14 +1124,14 @@ The EU Accounting Directive (Directive 2013/34/EU, art 41(4)) defines projects l - - + + - - + + true @@ -1149,32 +1149,32 @@ Definitions used around the world still differ somewhat but there is increasing Site - - + + - - + + - - + + - - + + - + true @@ -1221,12 +1221,6 @@ ResourceProjects.org records point coordinates (in lat-long format) identifying - - - - - - @@ -1235,8 +1229,8 @@ ResourceProjects.org records point coordinates (in lat-long format) identifying - - + + @@ -1247,8 +1241,8 @@ ResourceProjects.org records point coordinates (in lat-long format) identifying - - + + true From d22d2f72c40df67c89753595742a93c7b16bae6e Mon Sep 17 00:00:00 2001 From: timgdavies Date: Sat, 24 Oct 2015 14:46:06 -0500 Subject: [PATCH 2/3] Adding url to contract --- ontology/resource-projects-ontology.rdf | 1 + 1 file changed, 1 insertion(+) diff --git a/ontology/resource-projects-ontology.rdf b/ontology/resource-projects-ontology.rdf index db98799..1d8333d 100644 --- a/ontology/resource-projects-ontology.rdf +++ b/ontology/resource-projects-ontology.rdf @@ -599,6 +599,7 @@ unknown - + From ec7df5341eb79a34a42a6eacd3a8a0bdb697330d Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Mon, 16 Nov 2015 14:51:32 +0000 Subject: [PATCH 3/3] Remove TagLifter.md This can now be found at https://github.com/OpenDataServices/TagLifter/blob/master/DesignNotes.md --- modules/TagLifter.md | 214 ------------------------------------------- 1 file changed, 214 deletions(-) delete mode 100644 modules/TagLifter.md diff --git a/modules/TagLifter.md b/modules/TagLifter.md deleted file mode 100644 index b2ed045..0000000 --- a/modules/TagLifter.md +++ /dev/null @@ -1,214 +0,0 @@ -# TagLifter - -Tag Lifter takes a spreadsheet of data, marked up with #tag headings for columns, and converts this to a Linked Data graph based on an ontology. - -Tags may take the following forms: - -| N | Tag | Interpretation | -|---|-----|----------------| -| 1 | #class | Create a new entity with the value of this column as skos:PrefLabel | -| 2 | #class+**identifier** | Use the value of this column as the identifier of any #class in this row | -| 3 | #class+dataProperty | Use the value of this column as the literal value of the data property of the class entity | -| 4 | #class+class | Look for a **direct** relationship between the two classes (in either direction **NOT CURRENTLY IMPLEMENTED**), and assert the objectProperty between the two classes. If no direct relationship exists, look for an intermediate step and establish this relationship instead. | -| 5 | #class+class+dataProperty | See if the dataProperty can attach to the second class and if so, attach it. If not, see if there was an intermediate entity created to join the two classes, and if the dataProperty can attach to this, add it here. | - -In addition, tags may include: - -**+n** to distinguish two instances of the same class or data property in the same row. For example, #project+1 and #project+2 - -**+en** or any other two-digit country code to indicate the language that should be applied to any string literals created for that column. - -To parse spreadsheets Tag Lifter will: - -- Read left-to-right across each row; -- Whenever it encounters a new class, check to see if any subsequent column contains a name and identifier for this; -- Check for relationships between any classes at the same level of the tag hierarchy; -- Cache identifiers for entities; - -When reading a multiple tabbed spreadsheet, TagLifter will cache the identifiers for any named entity. For example, once it has established an identifier for a #project named 'Jubilee', it will use this identifier on future sheets for rows containing a #project column where the cell contains 'Jubilee', even if no #project+identifier column is present. - - -## Examples - -### #Class - -Input: - -| #project | -|----------| -| Jubilee Fields | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en. -``` - -The ```identifierPattern``` property of each class in the ontology is used to determine how identifiers should be generated if no +identifier column is present. - -### #class+identifier - -Identifier is a reserved keyword. - -Input: - -| #project | #project+identifier | -|----------|---------------------| -| Jubilee Fields | gh/jufi-asd24f | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en. -``` - -### #class+dataProperty - -Input: - -| #source | #source+identifier | #source+url -|----------|---------------------| -| Projects Report | | http://www.example.com/project-report | - -Output: - -``` - a base:Source; - skos:prefLabel "Projects Report"@en; - base:url "http://www.example.com/project-report". -``` - -### #class+class - -#### Direct relationship - -Where the ontology allows a direct relationship between the two classes, such as: - -``` base:relatedContract ``` - -Input: - -| #project | #project+identifier | #project+contract | -|----------|---------------------|-------------------| -| Jubilee Fields | gh/jufi-asd24f | Jubilee Contract | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en; - base:relatedContract . - - a base:Contract; - skos:prefLabel "Jubilee Contract"@en. -``` - -#### Indirect relationship - -Where an intermediate entity sits between the two classes, such as: - -``` hasStake hasStakeholder ``` - -Input: - -| #project | #project+identifier | #project+company | #project+company+identifier | -|----------|---------------------|-------------------|----------------------------| -| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en; - base:hasStake . - - a base:Stake; - base:hasStakeholder . - - a base:Company; - skos:prefLabel "Tullow Oil"@en. -``` - - -### #class+class+dataProperty - -#### Direct relationship - -Where the ontology allows a direct relationship between the two classes, such as: - -``` base:source ``` - -Input: - -| #project | #project+identifier | #project+source | #project+source+url | -|----------|---------------------|-------------------|----------------------------| -| Jubilee Fields | gh/jufi-asd24f | Project Report | http://www.example.com/project-report | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en; - base:source . - - a base:Source; - skos:prefLabel "Projects Report"@en; - base:url "http://www.example.com/project-report". -``` - -#### Indirect relationship - -Where an intermediate entity sits between the two classes, such as: - -``` hasStake hasStakeholder ``` - -and the property attaches to the intermediate entity. - -Input: - -| #project | #project+identifier | #project+company | #project+company+identifier | #project+company+share | -|----------|---------------------|-------------------|----------------------------|------------------------| -| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | 10 | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en; - base:hasStake . - - a base:Stake; - base:hasStakeholder ; - base:share 10. - - a base:Company; - skos:prefLabel "Tullow Oil"@en. -``` - - -### #class and #class - -Where two classes are next to each other, and then can be related, establish the relationship. - -Input: - -| #project | #project+identifier | #company | #company+identifier | -|----------|---------------------|----------|---------------------| -| Jubilee Fields | gh/jufi-asd24f | Tullow Oil | gh/tullow-oil | - -Output: - -``` - a base:Project; - skos:prefLabel "Jubilee Fields"@en; - base:hasStake . - - a base:Stake; - base:hasStakeholder . - - a base:Company; - skos:prefLabel "Tullow Oil"@en. -``` -