8000 GitHub - rudof-project/vocab: Rudof vocabulary · GitHub
[go: up one dir, main page]

Skip to content
rudof-projectPublic

About

Rudof vocabulary

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

rudof vocabulary

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

How the project works

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:

  1. It validates the vocabulary.
  2. It builds the site.
  3. 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:label in English.
  • The term has an rdfs:comment or a skos:definition.
  • The term has an rdfs:isDefinedBy value 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.

Initial setup

1. Set up the GitHub repository

Push the project to GitHub:

git remote add origin git@github.com:<OWNER>/<REPO>.git
git push -u origin main

In the repository, go to Settings → Pages → Build and deployment → Source. Select GitHub Actions.

GitHub publishes the site at https://<OWNER>.github.io/<REPO>/.

2. Set up the PURL

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.

3. Do a test of the IRIs

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 Turtle

Content negotiation

The 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/visited sees 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/turtle and does not read HTML does not get the RDF. This client must use the .ttl IRI.

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 .htaccess file reads the Accept header and sends a redirect to the applicable file. Many vocabularies use w3id.org. With this solution, the namespace changes to https://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 Accept header and sends the applicable file. Set the PURL target to the proxy domain. The PURL IRIs do not change.

Add a term

  1. 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" .
  2. Change the value of dcterms:modified.

  3. If necessary, change the value of owl:versionInfo.

  4. 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.

Build the site on your computer

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/

Contributions

Read AGENTS.md before you make a contribution. The rules in that file apply to persons and to AI agents.

About

Rudof vocabulary

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0