This project publishes an RDFS/OWL vocabulary. The vocabulary defines concepts that rudof uses.
| Namespace | https://purl.archive.org/rudof/vocab/ |
| Ontology IRI | https://purl.archive.org/rudof/vocab |
| Preferred prefix | rd |
vocab/rudof.ttl ──► scripts/build.py ──► _site/ ──► GitHub Pages
(source file) (validate + build) (GitHub Actions)
The file vocab/rudof.ttl is the only source file. Do not edit the files in _site/.
When you push to main, the workflow .github/workflows/pages.yml does these steps:
- It validates the vocabulary.
- It builds the site.
- It deploys the site to GitHub Pages.
For a pull request, the workflow does steps 1 and 2 only. Thus, an incorrect vocabulary cannot go into main without an error.
The site has the same structure as the URI space:
URL below …/rudof/vocab/ |
Content |
|---|---|
| (root) | HTML documentation for the full vocabulary |
vocab.ttl vocab.jsonld vocab.rdf vocab.nt |
The full vocabulary in RDF |
Each HTML page also contains these items:
- The RDF of the page as JSON-LD, in a
<script type="application/ld+json">element. Thus, a Linked Data client that gets HTML also gets the RDF. - A
<link rel="alternate" type="…">element for each RDF format. - A
<link rel="canonical">element with the PURL.
The build script does these checks on the ontology:
- The ontology has a title, a description, a license, a version and a preferred prefix.
The build script does these checks on each term:
- The term has a type.
- The term has an
rdfs:labelin English. - The term has an
rdfs:commentor askos:definition. - The term has an
rdfs:isDefinedByvalue that is the ontology IRI.
After the build, the script parses each RDF file again. If a check fails, the build stops with an error.
Push the project to GitHub:
git remote add origin git@github.com:<OWNER>/<REPO>.git
git push -u origin mainIn the repository, go to Settings → Pages → Build and deployment → Source. Select GitHub Actions.
GitHub publishes the site at https://<OWNER>.github.io/<REPO>/.
On https://purl.archive.org/, go to your rudof domain. Create one PURL with these values:
| Field | Value |
|---|---|
| Path | /rudof/vocab |
| Type | Partial |
| Target | https://<OWNER>.github.io/<REPO> (no slash at the end) |
A partial PURL adds the remaining part of the path to the target. Thus, one PURL is sufficient for all the IRIs in the namespace:
https://purl.archive.org/rudof/vocab → https://<OWNER>.github.io/<REPO>/
https://purl.archive.org/rudof/vocab/visited → https://<OWNER>.github.io/<REPO>/visited/
https://purl.archive.org/rudof/vocab/visited.ttl → https://<OWNER>.github.io/<REPO>/visited.ttl
When you add a term to rudof.ttl, its IRI resolves after the next deployment. It is not necessary to add a PURL.
curl -sIL https://purl.archive.org/rudof/vocab/visited # Shows the redirects to the HTML page
curl -sL https://purl.archive.org/rudof/vocab/visited.ttl # Shows the term in Turtle
curl -sL https://purl.archive.org/rudof/vocab/vocab.ttl # Shows the full vocabulary in TurtleThe best practice is that one IRI gives HTML to a browser and RDF to an RDF client. The RDF client sends a header such as Accept: text/turtle. Refer to these documents:
purl.archive.org and GitHub Pages cannot do content negotiation. purl.archive.org only does redirects. GitHub Pages sends static files and does not read the Accept header.
With this setup, the results are as follows:
- A person who opens
https://purl.archive.org/rudof/vocab/visitedsees the documentation page. - An RDF client gets the same HTML page. The page contains the RDF as JSON-LD and links to the RDF files.
- A client that can read JSON-LD in HTML gets the RDF. Examples are rdflib and Apache Jena.
- A client that sends
Accept: text/turtleand does not read HTML does not get the RDF. This client must use the.ttlIRI.
NOTE: To get full content negotiation, change only the redirect layer. It is not necessary to change this project.
You can use one of these two solutions:
- w3id.org: A
.htaccessfile reads theAcceptheader and sends a redirect to the applicable file. Many vocabularies use w3id.org. With this solution, the namespace changes tohttps://w3id.org/rudof/…. - A proxy in front of GitHub Pages: An example is a Cloudflare Worker on a domain that you control. The proxy reads the
Acceptheader and sends the applicable file. Set the PURL target to the proxy domain. The PURL IRIs do not change.
-
Add the term to
vocab/rudof.ttl. For example:rd:Shape a rdfs:Class, owl:Class ; rdfs:label "Shape"@en ; rdfs:comment "A set of constraints on the neighbourhood of a node."@en ; rdfs:isDefinedBy <https://purl.archive.org/rudof/vocab> ; vs:term_status "unstable" . -
Change the value of
dcterms:modified. -
If necessary, change the value of
owl:versionInfo. -
Push the change.
CAUTION: Do not remove or rename a published term. Other data can use its IRI. To stop the use of a term, set vs:term_status "archaic" or owl:deprecated true.
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python scripts/build.py # Writes the site to _site/
python -m http.server -d _site 8000 # Open http://localhost:8000/visited/Read AGENTS.md before you make a contribution. The rules in that file apply to persons and to AI agents.