-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
497 changed files
with
300,863 additions
and
565 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
function.xml | ||
catalog*.xml | ||
node_modules/ | ||
*.iml |
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 @@ | ||
# 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 |
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,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 |
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 |
---|---|---|
@@ -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; | ||
} |
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,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] |
Oops, something went wrong.