Questions? Arrange a call now!

VEC RDF Toolkit

The availability of the VEC (Vehicle Electric Container) as an OWL ontology opens up a wide range of new possibilities for using vehicle electrical system data in practice. The VEC ontology is the basis for using vehicle electrical system data in knowledge graphs or as interoperable linked data. It also provides access to the technologies of the semantic web stack.

However, the VEC ontology alone is not enough if you want to get started. It “only” describes the meta-model of the VEC in a suitable form. It is also necessary to have the user data available in an RDF-compatible format.

If the data is available as RDF, there are two basic use cases:

  1. Performing analyses and queries on the data. The standardized query language SPARQL exists for this purpose.
  2. Checking semantic rules. The standardized rule language SHACL exists for this purpose.

Both are only possible in the XML stack of the VEC with great effort, non-standardized and/or with high complexity and poor performance (in the past there have been experiments to achieve this on the basis of Schematron and XPath, for example).

Both use cases will be used by the VEC community in the future to build a compliance test suite. The aim is to use semantic rules and evaluations to improve the interoperability of different VEC implementations, avoid the formation of dialects and check the use of extension options for VECs (e.g. custom properties).

In order to make the compliance test suite usable in practice as quickly as possible and to lower the entry barrier into the world of Linked Data for the VEC community, we have decided to make our VEC RDF Toolkit publicly available free of charge. It currently offers two functions:

  1. Convert: Converting VEC XML data to RDF.
  2. Validate: Execution of SHACL constraints and SPARQL queries on VEC XML data (these are converted internally to RDF beforehand). The results are then summarized in an Excel report.

Functionality

The VEC RDF Toolkit is currently a Java application for the command line. A functional Java 21 JRE/JDK is required. If required, this can be downloaded from Adoptium. It is not necessary to install the toolkit, but it may be necessary to adapt the startup scripts supplied.

The toolkit currently supports the following VEC versions:

Convert

A 1:1 conversion of VEC XML to RDF is performed. The result is saved as a Turtle file and one of the main aspects is the generation of URIs for RDF resources. In RDF, each data element is assigned a globally unique URI. The quality of the URIs used determines the usability of the data in distributed data storage. Although the VEC introduced an immutable-global-iri with version 2.1, this is not yet used by existing interface implementations.

For this reason, suitable URIs must be generated during conversion. The strategy used here is very simple and sufficient for the use cases supported by the VEC RDF Toolkit. The converter receives a basic namespace as a parameter during execution. This namespace, the name of the VEC file and the XML ID of the respective element are then used to create unique URIs according to the following scheme:

{baseNameSpace}/{fileName-without-Extension}#{Vec-Class-Name}-{XML-ID}

For example: https://www.acme.inc/conversion/test/oldbeetle_vec113#PartOccurrence-id_partOccurrence_23864

This strategy allows the converter to generate URIs without any contextual knowledge while maintaining the integrity of references. Other useful properties of URIs, such as temporal stability or that the same element always receives the same URI, regardless of the data exchange, are not achieved in this way. For more advanced use cases, such as the use of data in a distributed scenario, more advanced strategies would have to be used, but these would then require a certain amount of contextual knowledge.

Primitive data types of the VEC (e.g. NumericalValue or LocalizedString) are converted as Blank Nodes and therefore do not receive a URI.

Validate

The validation requires the following input:

  1. One or more VEC XML files (wildcard patterns).
  2. The VEC ontologies and SHACL schemas published for the VEC version (these are provided together with the toolkit).
  3. The definition of a validation suite. The VEC compliance tests are an example of a suite definition. A validation suite consists of:
    1. a general ontology, which may contain derivations, generalizations and the like to facilitate the formulation of rules and queries. The inference rules from RDFS are essentially supported here.
    2. A SHACL schema with semantic rules that are to be checked.
    3. A set of SPARQL queries that are to be evaluated for each file.
Figure: validation workflow

Figure: validation workflow

The validation process then proceeds as shown in the figure:

  1. On-the-fly conversion of the VEC XML data to RDF.
  2. Application of the inference rules of the ontologies of the appropriate VEC version and the validation suite.
  3. Evaluating the SHACL rules of the VEC standard and the validation suite.
  4. Evaluating the defined queries.
  5. Generating an Excel report

Usage

usage: java -jar vecrdf-<version>.jar --command=<command> [--ns=<arg>] --source=<uri-pattern>
       [--suite=<path-to-validation-suite>]

The VEC RDF Toolkit is supposed to support the VEC community in the adoption of the VEC standard.
At the moment it supports two main use cases:
    CONVERT:  Conversion of existing VEC XML files into RDF conforming to the VEC ontology.
              The URI generation strategy applied is quite simple. For real world uses, more
              advanced strategies are required, to enable stable and consistent identification
              of resources across files.
    VALIDATE: Supports the validation & analysis of VEC XML files with RDF technology.
              This command supports the ECAD-IF compliance test suite. However, it be extend
              with your own queries and constraints.

    --command=<command>                  Chooses the command / action the VEC RDF Toolkit will
                                         execute. Possible values are: convert/validate
    --ns=<arg>                           The target namespace in which resources are created during
                                         conversion. default is https://www.example.com
    --source=<uri-pattern>               The files to be handled. This is can be a pattern, e.g.:
                                         'some-dir/**/*.vec'
    --suite=<path-to-validation-suite>   A path to a validation suite directory. Default is
                                         'compliance-suite' expecting a 'compliance-suite' directory
                                         in the current directory. A valid validation suite is
                                         required for validation.

Example

This call validates all VEC files in the directory data and below with the compliance test suite, which was unpacked into the directory ../path-to-suite.

java -jar vecrdf-x.y.z.jar --command=validate --ns=https://www.4soft.de --source=data/**/*.vec --suite=../path-to-suite

Feedback

For bug reports, suggestions or feature requests, we have set up a public Github repository for the VEC RDF Toolkit. Please use the issue management there. If you have other requests, e.g. how to use this technology in your use cases, please contact us directly.

Disclaimer & Download

According to the license terms, the software may only be used for evaluation, testing or training purposes.

Use in production environments, in particular for operational purposes or for processing production data within workflows, is expressly prohibited. The processing of real data is permitted for evaluation purposes, provided that the software is not used for productive operation.

If you like to use the software in those scenarios, please contact us by email.

Johannes Becker

Johannes Becker

Managing Consultant

+49 89 5307 44-523

becker@4soft.de