8000 GitHub - Zack-83/VIMonto
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Zack-83/VIMonto

 
 

Repository files navigation

Some experiments towards a VIM-based formal ontology

The International Vocabulary of Metrology is a JCGM guidance document aimed at providing a foundational concept system of metrology. It is a semi-structured document, written in English (and French), with intensional definitions compliant with ISO 704.
Together with the official PDF version, an HTML, interactive version of the VIM was developed and made freely available: hence, that is a human-oriented tool.
This is instead an experiment to develop a machine-oriented (e.g., machine-readable) version of the VIM, in the form of an RDF triple store, more or less according to this diagram:
schema
where, of course, the RDF db could be integrated or made interoperable with information coming from other sources, for example and in particular ontologies about units.

The core module is vimrdf.py, that depends only on rdflib and that defines the class VIMRDF that provides several methods to:

  • read a properly formatted JSON file with the VIM information (the current, very partial, example is vimrdf.json, which includes a few entries from VIM, Chapter 1, in English and other sample languages (French and Italian)) and create the structure of the db;
  • optionally read properly formatted JSON files with exemplary instances (at the moment, very partial examples are about kinds of quantities (vimkinds.json) and units (vimunits.json)) and populate the previously created db;
  • serialize / dump the content of the db to a TTL/RDF-XML/JSON-LD/... file;
  • reload the content of the db from a TTL/RDF-XML/JSON-LD/... file;
  • variously query the db, with Python or SPARQL calls.

(vimrdf2.py and vimrdf2.json are older versions of vimrdf.py and vimrdf.json respectively, with no handling of multiple languages)

At the moment three samples are provided, all importing vimrdf.py, creating an instance of VIMRDF, creating a db and populating it from a JSON file:

  • vimrdfapi.py, to be run from the command line as python vimrdfapi.py, starts a local web server and exposes an API, whose Swagger documentation is accessible at localhost:8080/docs
  • vimrdftest.py displays a menu of exemplary Python calls and executes the chosen one;
  • vimrdfquery.py displays a menu of exemplary SPARQL calls and executes the chosen one.

Changes with respect to the previous version:

20 Feb 23:

  • slightly refined the structure of API-related functions, now generating either JSON- or XML-formatted responses;
  • added an API endpoint for generic SPARQL calls.

14 Feb 23:

  • added a preliminary version of the API via FastAPI, at the moment only generating JSON-formatted responses;
  • added to this readme the description of the procedure to set up the Python environment (see below) and the requirements.txt file.

13 Feb 23:

  • revised all query methods for handling terms and definitions in multiple languages.

12 Feb 23:

  • some query methods adapted for handling terms and definitions in multiple languages.

11 Feb 23:

  • extended the JSON schema to handle terms and definitions in multiple languages and adapted the related Python methods accordingly (query methods still to be adapted);
  • added the method to populate the RDF db by reloading a TTL file generated by dumping the db itself.

Open issues:

  • scope: only VIM chapter 1 or more? (up to the entire VIM) and immediately the VIM3 or waiting for the VIM4?
  • API design: granularity of the endpoints?
  • primitives: how to deal with concepts whose superordinate is a primitive?
    • subclasses of external superclasses when known
    • subclasses of VIMEntity
    • subclasses of defined ("dummy") superclasses
    • ...
  • relational properties other than subClassOf: how to deal with them?
  • should VIMRDF methods better return the reference to an entry as its subject or its term?
  • for a minimally serious development, an appropriate namespace will need to be chosen and a licence will need to be added

A procedure to set up a Python virtual environment
(tested on a Linux machine with Anaconda)

  • create a directory and cd
  • create the virtual environment:
    conda create -n vimonto python
  • activate the virtual environment:
    conda activate vimonto
  • install the Python module for interactive management (optional): pip install ipykernel
  • install the Python module for requirements management (optional; alternatively the requirements.txt file in this repo can be used): pip install pipreqs
  • create requirements.txt (optional; alternatively the requirements.txt file in this repo can be used): pipreqs
  • install required modules: pip install -r requirements.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0