Skip to content

Commit

Permalink
FIx redefinition of external vocabularies
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianvasquez committed Jul 26, 2024
1 parent 320c51e commit 66507c5
Show file tree
Hide file tree
Showing 22 changed files with 11,770 additions and 57 deletions.
2 changes: 1 addition & 1 deletion outputs/externalVocabularies/external-vocabularies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
```

[source](./externalVocabularies.js) 2024-07-10T11:13:34.475Z
[source](./externalVocabularies.js) 2024-07-26T13:25:32.384Z

## ePO relations using external vocabulary as Domain

Expand Down
33 changes: 31 additions & 2 deletions outputs/getRedefined.js → outputs/fixRedefined.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
import rdf from 'rdf-ext'
import { ns } from '../src/namespaces.js'
import { createTriplestore, doConstruct } from '../src/sparql/localStore.js'

function getRedefined ({ assets }) {
function filterDataset (redefined, dataset) {
// Subjects to remove
const subjects = rdf.termSet()
for (const quad of redefined) {
subjects.add(quad.subject)
}
// Traverse the dataset, go deeper if is a blank but do not follow ePO subjects
const traverser = rdf.traverser(({
dataset,
level,
quad,
}) => !quad.subject.value.startsWith(ns.a4g().value) ||
quad.subject.termType === 'BlankNode')

const unwanted = rdf.dataset()
for (const term of [...subjects]) {
traverser.forEach({ term, dataset }, ({ dataset, level, quad }) => {
unwanted.add(quad)
})
}

const wanted = dataset.difference(unwanted)

return { wanted, unwanted }

}

function fixRedefined ({ assets }) {
const store = createTriplestore({ assets })

const filterUnwantedQuery = `
Expand Down Expand Up @@ -55,4 +84,4 @@ WHERE {
return doConstruct({ store, query: filterUnwantedQuery })
}

export { getRedefined }
export { fixRedefined, filterDataset }
34 changes: 34 additions & 0 deletions outputs/temporal-export/doOWLSplit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { mkdirSync, writeFileSync } from 'fs'
import { getRdfAssets } from '../../src/io/assets.js'
import {
prettyPrintTurtle,
} from '../../src/io/serialization.js'
import { filterDataset, fixRedefined } from '../fixRedefined.js'
import { dirname } from 'path'
import { UNDER_REVIEW } from '../../src/config.js'
import rdf from 'rdf-ext'

const { localPath } = UNDER_REVIEW
const globPattern = `${localPath}/implementation/*/owl_ontology/*.ttl`
// const globPattern = `${localPath}/implementation/eAccess/owl_ontology/*_restrictions.ttl`

const assets = await getRdfAssets({ globPattern }, (path) => rdf.defaultGraph())

for (const asset of assets) {

const { path, dataset } = asset

const redefined = fixRedefined({ assets: [asset] })
const { wanted, unwanted } = filterDataset(redefined, dataset)

const targetPath = path.replaceAll(`${localPath}`,
'outputs/temporal-export')
mkdirSync(dirname(targetPath), { recursive: true })

const wantedTurtle = await prettyPrintTurtle({ dataset: wanted })
const wantedPath = `${targetPath}`
writeFileSync(wantedPath, wantedTurtle)

}


49 changes: 0 additions & 49 deletions outputs/temporal-export/doOWLfiltering.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@prefix schema: <http://schema.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix cpov: <http://data.europa.eu/m8g/> .
@prefix a4g: <http://data.europa.eu/a4g/ontology#> .
@prefix sfrml: <http://data.europa.eu/a4g/mapping/sf-rml/> .
@prefix a4g_shape: <http://data.europa.eu/a4g/data-shape#> .
@prefix eli: <http://data.europa.eu/eli/ontology#> .
@prefix m8g: <http://data.europa.eu/m8g/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix person: <http://www.w3.org/ns/person#> .
@prefix locn: <http://www.w3.org/ns/locn#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix adms: <http://www.w3.org/ns/adms#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix r2rml: <http://www.w3.org/ns/r2rml#> .
@prefix at: <http://publications.europa.eu/ontology/authority/> .
@prefix atold: <http://publications.europa.eu/resource/authority/> .
@prefix vann: <http://purl.org/vocab/vann/> .

a4g:ESPDRequest a owl:Class ;
rdfs:isDefinedBy a4g:acc ;
rdfs:subClassOf a4g:ProcurementDocument ;
skos:definition "An updated self-declaration used by the economic operator as a preliminary evidence in replacement of certificates issued by public authorities or third parties confirming that the economic operator fulfils the Exclusion Grounds and the Selection Criteria set out by the Buyer for a specific Procurement. WG Approval 05/03/2024"@en ;
skos:prefLabel "E s p d request"@en .

a4g:acc a owl:Ontology ;
dcterms:description "The eProcurement Ontology Access core describes the concepts and properties representing the European Public Procurement Access domain. The provision of these semantics offers the basis for a common understanding of the domain for all stakeholders ensuring the quality of data exchange and transparency. The ontology restrictions are published in a separate artefact."@en ;
dcterms:title "eProcurement Ontology Access - core"@en ;
rdfs:label "eProcurement Ontology Access - core"@en ;
dcterms:created "2021-06-01"^^xsd:date ;
dcterms:issued "2024-07-10"^^xsd:date ;
dcterms:license "© European Union, 2014. Unless otherwise noted, the reuse of the Ontology is authorised under the European Union Public Licence v1.2 (https://eupl.eu/)." ;
dcterms:publisher "http://publications.europa.eu/resource/authority/corporate-body/PUBL" ;
vann:preferredNamespacePrefix "epo" ;
vann:preferredNamespaceUri "http://data.europa.eu/a4g/ontology#" ;
rdfs:comment "This version is automatically generated from eAccess.xml on 2024-07-10" ;
rdfs:seeAlso <https://docs.ted.europa.eu/home/index.html>, <https://github.com/OP-TED/ePO/releases>, <https://joinup.ec.europa.eu/collection/eprocurement/solution/eprocurement-ontology/about>, <https://op.europa.eu/en/web/eu-vocabularies/e-procurement> ;
owl:imports a4g:core, a4g:sub, <http://data.europa.eu/eli/ontology#>, <http://data.europa.eu/m8g/>, <http://iflastandards.info/ns/fr/frbr/frbroo/>, <http://purl.org/dc/terms/>, <http://purl.org/vocab/vann/>, <http://www.w3.org/2004/02/skos/core>, <http://www.w3.org/2006/time>, <http://www.w3.org/ns/adms>, <http://www.w3.org/ns/locn>, <http://www.w3.org/ns/org#>, <http://www.w3.org/ns/person>, <http://xmlns.com/foaf/0.1/> ;
owl:incompatibleWith "3.1.0" ;
owl:priorVersion "http://data.europa.eu/a4g/ontology#acc-4.0.2" ;
owl:versionIRI a4g:acc-4.1.0 ;
owl:versionInfo "4.1.0" .

a4g:concernsProcedure a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:definition "Relates to Procedure. WG approval 05/03/2024 (epo-acc:ESPDRequest -> epo:Procedure (+epo:concernsProcedure))"@en ;
skos:prefLabel "Concerns procedure"@en ;
skos:editorialNote "The relations epo-acc:concernsProcedure and epo:refersToProcedure have to refer to the same Procedure."@en .

a4g:hasResourceType a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:prefLabel "Has resource type"@en .

a4g:hasSubdivision a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:prefLabel "Has subdivision"@en .

a4g:refersToNotice a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:definition "Reference to a Notice. WG approval 12/03/2024 (epo-acc:ESPDRequest -> epo:Notice (+epo-acc:refersToNotice))"@en ;
skos:prefLabel "Refers to notice"@en .

a4g:relatesToESPDRequest a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:definition "Is about an European Single Procurement Document (ESPD) Request. WG approval 05/03/2024 (epo-sub:ESPD -> epo-acc:ESPDRequest (+epo-sub:relatesToESPDRequest))"@en ;
skos:prefLabel "Relates to e s p d request"@en .

a4g:specifiesProcurementCriterion a owl:ObjectProperty ;
rdfs:isDefinedBy a4g:acc ;
skos:prefLabel "Specifies procurement criterion"@en .

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@prefix schema: <http://schema.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix cpov: <http://data.europa.eu/m8g/> .
@prefix a4g: <http://data.europa.eu/a4g/ontology#> .
@prefix sfrml: <http://data.europa.eu/a4g/mapping/sf-rml/> .
@prefix a4g_shape: <http://data.europa.eu/a4g/data-shape#> .
@prefix eli: <http://data.europa.eu/eli/ontology#> .
@prefix m8g: <http://data.europa.eu/m8g/> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix person: <http://www.w3.org/ns/person#> .
@prefix locn: <http://www.w3.org/ns/locn#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix adms: <http://www.w3.org/ns/adms#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix r2rml: <http://www.w3.org/ns/r2rml#> .
@prefix at: <http://publications.europa.eu/ontology/authority/> .
@prefix atold: <http://publications.europa.eu/resource/authority/> .
@prefix vann: <http://purl.org/vocab/vann/> .

a4g:acc-restriction a owl:Ontology ;
rdfs:label "eProcurement Ontology Access - core restrictions"@en ;
dcterms:created "2021-06-01"^^xsd:date ;
dcterms:description "The eProcurement Ontology Access core restrictions provides the restrictions and the inference-related specifications on the concepts and properties in the eProcurement Ontology Access core."@en ;
dcterms:issued "2024-07-10"^^xsd:date ;
dcterms:license "© European Union, 2014. Unless otherwise noted, the reuse of the Ontology is authorised under the European Union Public Licence v1.2 (https://eupl.eu/)." ;
dcterms:publisher "http://publications.europa.eu/resource/authority/corporate-body/PUBL" ;
dcterms:title "eProcurement Ontology Access - core restrictions"@en ;
vann:preferredNamespacePrefix "epo" ;
vann:preferredNamespaceUri "http://data.europa.eu/a4g/ontology#" ;
rdfs:comment """This version is automatically generated from eAccess.xml on
2024-07-10""" ;
rdfs:seeAlso <https://docs.ted.europa.eu/home/index.html>, <https://github.com/OP-TED/ePO/releases>, <https://joinup.ec.europa.eu/collection/eprocurement/solution/eprocurement-ontology/about>, <https://op.europa.eu/en/web/eu-vocabularies/e-procurement> ;
owl:imports a4g:acc, a4g:core, a4g:sub, <http://data.europa.eu/eli/ontology#>, <http://data.europa.eu/m8g/>, <http://iflastandards.info/ns/fr/frbr/frbroo/>, <http://purl.org/dc/terms/>, <http://purl.org/vocab/vann/>, <http://www.w3.org/2004/02/skos/core>, <http://www.w3.org/2006/time>, <http://www.w3.org/ns/adms>, <http://www.w3.org/ns/locn>, <http://www.w3.org/ns/org#>, <http://www.w3.org/ns/person>, <http://xmlns.com/foaf/0.1/> ;
owl:incompatibleWith "3.1.0" ;
owl:priorVersion "http://data.europa.eu/a4g/ontology#acc-restriction-4.0.2" ;
owl:versionIRI a4g:acc-restriction-4.1.0 ;
owl:versionInfo "4.1.0" .

a4g:concernsProcedure rdfs:domain a4g:ESPDRequest ;
rdfs:range a4g:Procedure .

a4g:hasResourceType rdfs:domain eli:LegalResource ;
rdfs:range skos:Concept .

a4g:hasSubdivision rdfs:domain eli:LegalResourceSubdivision ;
rdfs:range skos:Concept .

a4g:refersToNotice rdfs:domain a4g:ESPDRequest ;
rdfs:range a4g:Notice .

a4g:relatesToESPDRequest rdfs:domain a4g:ESPD ;
rdfs:range a4g:ESPDRequest .

a4g:specifiesProcurementCriterion rdfs:domain a4g:ESPDRequest ;
rdfs:range a4g:ProcurementCriterion .

Loading

0 comments on commit 66507c5

Please sign in to comment.