-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added 250+ new ontologies; further rework and refinements ...
summary: - added a way to include manually maintained ontologies - added a workflow to check manually maintained ontologies to find broken links
- Loading branch information
Showing
14 changed files
with
696 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Check manually maintained metadata about ontologies | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
CI: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
ini-values: memory_limit=1G | ||
|
||
- name: Check | ||
run: scripts/bin/check-manually-maintained-metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
FROM php:8.2-cli | ||
FROM php:8.3-cli | ||
|
||
# install and setup required system library | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
curl git gnupg libicu-dev libpng-dev libzip-dev nano net-tools sudo unzip wget zlib1g-dev | ||
|
||
RUN docker-php-ext-install -j$(nproc) intl zip | ||
|
||
# install Composer globally (required to install PHP vendors) | ||
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer | ||
|
||
# add a non-root user to limit user rights | ||
RUN useradd -r --home /home/govi -u 1000 govi | ||
RUN usermod -a -G www-data govi | ||
RUN mkdir /home/govi | ||
RUN chown govi:www-data /home/govi | ||
RUN adduser govi sudo | ||
|
||
# add custom PHP.ini settings | ||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
COPY ./custom.ini /usr/local/etc/php/conf.d/custom.ini | ||
|
||
# create and mark working dir | ||
RUN mkdir /govi | ||
WORKDIR /govi | ||
|
||
# run this after container started to keep it alive | ||
CMD ["tail -f /dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
memory_limit = 1G | ||
upload_max_filesize = 64M | ||
post_max_size = 64M | ||
max_execution_time = 600 | ||
|
||
; report all errors | ||
error_reporting = E_ALL | ||
display_errors = On | ||
display_startup_errors = On |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/** | ||
* This file checks availability of all RDF files in manually-maintained-metadata-about-ontologies.csv | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use function App\isEmpty; | ||
use function App\urlIsAccessible; | ||
|
||
require_once 'bootstrap.php'; | ||
|
||
echo PHP_EOL.'Check availability of referenced RDF files ...'.PHP_EOL; | ||
|
||
$failingRdfFiles = []; | ||
|
||
$csvFileEntries = array_map('str_getcsv', file(__DIR__.'/../../'.MANUALLY_MAINTAINED_METADATA_ABOUT_ONTOLOGIES_CSV)); | ||
foreach ($csvFileEntries as $line => $entry) { | ||
if (0 == $line) { | ||
continue; | ||
} | ||
|
||
echo '.'; | ||
|
||
/** @var string|null */ | ||
$rdfFile = null; | ||
// takes the first defined RDF file and checks it | ||
foreach ([2, 3, 4, 5] as $key) { | ||
if (isset($entry[$key]) && false === isEmpty($entry[$key])) { | ||
$rdfFile = $entry[$key]; | ||
break; | ||
} | ||
} | ||
|
||
if (isEmpty($rdfFile)) { | ||
throw new Exception($entry[0].' has no related RDF File set'); | ||
} else { | ||
if (urlIsAccessible($rdfFile, 30, 10)) { | ||
// OK | ||
} else { | ||
$failingRdfFiles[] = [ | ||
'title' => $entry[0], | ||
'rdf-file' => $rdfFile, | ||
]; | ||
} | ||
} | ||
|
||
sleep(1); | ||
} | ||
|
||
$failingRdfFilesWereFound = 0 < count($failingRdfFiles); | ||
if ($failingRdfFilesWereFound) { | ||
echo PHP_EOL; | ||
echo PHP_EOL; | ||
echo 'The following RDF files are not accessible:'; | ||
echo PHP_EOL; | ||
var_dump($failingRdfFiles); | ||
echo PHP_EOL; | ||
return 1; | ||
} else { | ||
echo PHP_EOL; | ||
echo PHP_EOL; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\IndexEntry; | ||
|
||
use function App\isUrl; | ||
use function App\storeTemporaryIndexIntoSQLiteFile; | ||
|
||
/** | ||
* Merges manually maintained metadata into the SQLite file, if not known already. | ||
*/ | ||
|
||
require 'bootstrap.php'; | ||
|
||
echo PHP_EOL.'Merge in manually maintained metadata ...'; | ||
|
||
/* | ||
* open DB and get a list of all entries | ||
*/ | ||
$db = new PDO('sqlite:'.SQLITE_FILE_PATH); | ||
$sql = 'SELECT ontology_uri FROM entry ORDER BY ontology_title ASC'; | ||
$stmt = $db->prepare($sql); | ||
$stmt->execute(); | ||
$knownOntologyUris = $stmt->fetchAll(PDO::FETCH_COLUMN); | ||
|
||
/* | ||
* merge in all manually maintained metadata which is not already part of the SQLite file | ||
*/ | ||
$simplifiedOntologyList = []; | ||
|
||
// load CSV file and build simplified ontology list | ||
$entries = array_map('str_getcsv', file(__DIR__.'/../../'.MANUALLY_MAINTAINED_METADATA_ABOUT_ONTOLOGIES_CSV)); | ||
$unkownIndexEntries = []; | ||
foreach ($entries as $line => $row) { | ||
if (0 == $line) { | ||
// ignore header | ||
continue; | ||
} | ||
$ontologyUri = $row[1]; | ||
|
||
// check if ontology URI is already known | ||
$ontologyIsNotInSQLiteFileAlready = false === in_array($ontologyUri, $knownOntologyUris); | ||
if ($ontologyIsNotInSQLiteFileAlready && isUrl($ontologyUri)) { | ||
$entry = new IndexEntry('Manually maintained', 'https://github.com/k00ni/govi'); | ||
$entry->setOntologyTitle($row[0]); | ||
$entry->setOntologyUri($ontologyUri); | ||
|
||
// related files | ||
$entry->setLatestN3File($row[2]); | ||
$entry->setLatestNtFile($row[3]); | ||
$entry->setLatestRdfXmlFile($row[4]); | ||
$entry->setLatestTtlFile($row[5]); | ||
|
||
$entry->setLatestAccess($row[6]); | ||
|
||
$unkownIndexEntries[] = $entry; | ||
} else { | ||
$msg = 'Ontology '.$row[0].' ('.$ontologyUri.') is known and does not have to be maintained manually!'; | ||
$msg .= ' Please remove it from '.MANUALLY_MAINTAINED_METADATA_ABOUT_ONTOLOGIES_CSV; | ||
throw new Exception($msg); | ||
} | ||
} | ||
|
||
if (0 < count($unkownIndexEntries)) { | ||
echo PHP_EOL.'Store '.count($unkownIndexEntries).' unknown entries into SQLite file'; | ||
storeTemporaryIndexIntoSQLiteFile($unkownIndexEntries); | ||
} else { | ||
throw new Exception('No entries from '.MANUALLY_MAINTAINED_METADATA_ABOUT_ONTOLOGIES_CSV.' to add to SQLite file!'); | ||
} | ||
|
||
echo PHP_EOL; | ||
echo PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.* | ||
!.gitignore | ||
merge_cache |