Skip to content

Commit

Permalink
updated _everything_
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdmeest committed Jan 5, 2021
1 parent f94e31d commit 6641aa0
Show file tree
Hide file tree
Showing 497 changed files with 300,863 additions and 565 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
function.xml
catalog*.xml
node_modules/
*.iml
19 changes: 19 additions & 0 deletions CHANGELOG.fnoi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Function Ontology - Implementation Vocabulary Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## 0.1.1 - 2020-12-23

### Changed

- Updated and clarified definitions

## 0.1.0

### Added

- Creation
21 changes: 21 additions & 0 deletions CHANGELOG.fnom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Function Ontology - Implementation Vocabulary Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## 0.2.1 - 2020-12-23

### Changed

- Updated and clarified definitions

## 0.2.0

## 0.1.0

### Added

- Creation
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Roadmap

- [ ] TODO auto-fill same-semantics metadata
- [ ] TODO auto-fill same-semantics metadata as recommended by https://w3id.org/widoco/bestPractices

## Unreleased

## [1.0.0] - 2020-12-23

### Added

- Changelog
Expand Down Expand Up @@ -52,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- creation.

[1.0.0]: https://github.com/IDLabResearch/function-ontology/compare/v0.6.0...v1.0.0
[0.6.0]: https://github.com/IDLabResearch/function-ontology/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/IDLabResearch/function-ontology/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/IDLabResearch/function-ontology/compare/0.4.1...v0.5.0
Expand Down
13 changes: 13 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@
See https://w3id.org/function/spec for the full specification

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.595382.svg)](https://doi.org/10.5281/zenodo.595382)

## Releasing a new version

Make sure you have the WiDoCo 1.4.x jar downloaded in the root of this repo, and you have JAVA and Node.js installed.
Then, execute

```shell
npm install
cd ./dist
node build.js
```

The folders in `dist` should mimic the same structure and contents under https://w3id.org/function.
67 changes: 67 additions & 0 deletions dist/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const util = require('util');
const fs = require('fs/promises');
const exec = util.promisify(require('child_process').exec);

const $rdf = require('rdflib');
const Namespace = $rdf.Namespace;

const DC = Namespace("http://purl.org/dc/elements/1.1/");
const OWL = Namespace("http://www.w3.org/2002/07/owl#");
const RDF = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
const VANN = Namespace("http://purl.org/vocab/vann/");
const VOAF = Namespace("http://purl.org/vocommons/voaf#");

const map = [
{
ttlFile: "../fno.ttl",
outputFolder: "./ontology",
uri: "https://w3id.org/function/ontology#",
}, {
ttlFile: "../fnoi.ttl",
outputFolder: "./vocabulary/implementation",
uri: "https://w3id.org/function/vocabulary/implementation#",
}, {
ttlFile: "../fnom.ttl",
outputFolder: "./vocabulary/mapping",
uri: "https://w3id.org/function/vocabulary/mapping#",
},
]

processMap(map);

async function processMap(map) {
for (const elem of map) {
const store = await getStore(elem.ttlFile);
await runWidoco(elem.ttlFile, elem.outputFolder, store);
}
}

async function runWidoco(ontFile, outFolder, store) {
const preStuff = 'java -jar ../widoco-1.4.14-jar-with-dependencies.jar';
const postStuff = '-getOntologyMetadata -oops -rewriteAll -htaccess -webVowl -analytics UA-87734787-2 -excludeIntroduction';
const voc = store.any(null, RDF('type'), VOAF('Vocabulary'));
const version = store.any(voc, OWL('versionInfo')).value;
const uri = store.any(voc, VANN('preferredNamespaceUri')).value;
const prefix = store.any(voc, VANN('preferredNamespacePrefix')).value;
const commandVersion = `${preStuff} -ontFile ${ontFile} -outFolder ${outFolder}/${version} ${postStuff}`;
const {stdout, stderr} = await exec(commandVersion);
console.log(stdout);
console.warn(stderr);
const command = `${preStuff} -ontFile ${ontFile} -outFolder ${outFolder} ${postStuff}`;
await exec(command);
const appendData = `<p>The namespace is <b>${uri}</b>, the preferred prefix is <b>${prefix}</b></p>`;
await fs.appendFile(`${outFolder}/${version}/sections/abstract-en.html`, appendData);
await fs.appendFile(`${outFolder}/sections/abstract-en.html`, appendData);
const descriptionPlaceholder = `This is a placeholder text for the description of your ontology. The description should include an explanation and a diagram explaining how the classes are related, examples of usage, etc.`;
let description = await fs.readFile(`${outFolder}/sections/description-en.html`, 'utf8');
description = description.replace(descriptionPlaceholder, "Further description and explanation of these classes and properties are given in the Function Ontology Specification at https://w3id.org/function/spec");
await fs.writeFile(`${outFolder}/${version}/sections/description-en.html`, description);
await fs.writeFile(`${outFolder}/sections/description-en.html`, description);
}

async function getStore(ontFile) {
const store = $rdf.graph();
const body = await fs.readFile(ontFile, 'utf8');
$rdf.parse(body, store, "http://example.com/#", 'text/turtle');
return store;
}
47 changes: 47 additions & 0 deletions dist/ontology/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Turn off MultiViews
Options -MultiViews

# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config
AddType application/rdf+xml .rdf
AddType application/rdf+xml .owl
AddType text/turtle .ttl
AddType application/n-triples .n3
AddType application/ld+json .json
# Rewrite engine setup
RewriteEngine On
#Change the path to the folder here
RewriteBase /./ontology

# Rewrite rule to serve HTML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^$ index-en.html [R=303,L]

# Rewrite rule to serve JSON-LD content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/ld\+json
RewriteRule ^$ ontology.json [R=303,L]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^$ ontology.xml [R=303,L]

# Rewrite rule to serve N-Triples content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/n-triples
RewriteRule ^$ ontology.nt [R=303,L]

# Rewrite rule to serve TTL content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
RewriteCond %{HTTP_ACCEPT} \*/turtle
RewriteRule ^$ ontology.ttl [R=303,L]

RewriteCond %{HTTP_ACCEPT} .+
RewriteRule ^$ 406.html [R=406,L]
# Default response
# ---------------------------
# Rewrite rule to serve the RDF/XML content from the vocabulary URI by default
RewriteRule ^$ ontology.xml [R=303,L]
Loading

0 comments on commit 6641aa0

Please sign in to comment.