Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Latest commit

 

History

History
112 lines (88 loc) · 8.06 KB

README.md

File metadata and controls

112 lines (88 loc) · 8.06 KB

dcat-ap_validator

This software performs the validation of DCAT-AP rdf files. Validation is performed via a web form which loads a file (Turtle, RDF/XML, N-triples, JSON-LD) as graph in a triplestore and it queries the triple store with a SPARQL query. The output of the validation can be in XML (HTML with xslt transformation), JSON, Text, CSV, TSV.

The validator

The validator is located in the pages folder.

The validator is based on the dcat-ap_validator.html file which includes the dcat.js file responsible for loading the SPARQL query (dcat-ap.rq) and contacting the triplestore (Fuseki). If the result of the query is in XML format there is an XSLT stylesheet applied (xml-to-html-dcat-ap).

Rules

The SPARQL query contains several rules which are based on those available here: DCAT-AP Final 1.1

All the rules are stored in the rules folder. For almost each rule a test and a test data have been created.

Each rule is indicated with a progressive id number (starting from 0) and stored in a file named with the convention:

rule-id.rq

Therefore, for example, the rule 0 is stored in the file rule-0.rq.

Each rule is a SPARQL query which has been documented with sparql-doc annotations and validated with the online sparql validator.

When a rule is validated it is added to the dcat-ap.rq file (locates inside the pages folder) which is then loaded into the the web form via the dcat-ap_validator.js file.

Structure of a test data

Test data are located in tests-data folder and they are xml/rdf files to be tested against.

Each test data is directly connected to the rule id number and stored in a file named with the convention:

test-rule-id.rdf

Therefore, for example, the test data related to the rule 0 is stored in the file test-rule-0.rdf Not all the test data are implemented, for example literals are not tested.

Tests

Tests are located in tests folder and they are Javascript files.

A test exists only if the test-data has been created. A test file follows the name convention:

test-rule-id.js

Therefore, for example, the test which will validate again the test-rule-0.rdf will be called simply test-rule-0.js This is important because each test uses the rule number to open the related test data file.

Each tests performs 2 checks:

  1. The number of results of the validation of test data is the one expected
  2. The rule ID of the results is the one expected

Installation instructions

  1. The validator uses Fuseki 1 as triple store which you can download from the tools directory (jena-fuseki1-1.1.2-distribution.zip) or from an Apache mirror site.
  2. Unpack the binary distribution to your a FUSEKI_HOME folder of your choice.
  3. Copy the content of the pages folder under the FUSEKI_HOME folder. Keep the folder structure in tact. Verify that the file 'dcat-ap_validator.html' is in the FUSEKI_HOME/pages folder.
  4. Fuseki requires a Java Runtime Environment to be installed on your machine

User guide

  1. Launch Fuseki using the command in 'start_dcat-ap_validator.bat'
  2. As of version 1.1.0 launch the node server using the command in 'start_dcat-ap_validator-server.bat'
  3. Direct your browser to http://localhost:3030/dcat-ap_validator.html
  4. You get this page from Fuseki's internal web server.
  5. Select one or more RDF files that contain the software metadata to validate. Optionally, also controlled vocabularies can be incldued to verify correct usage of them.
  6. Optionally, you can set another SPARQL endpoint, output format, or even modify the SPARQL validation query.
  7. Hit the 'Validate' button. Fuseki returns the validation results within seconds.

Development

The development process is based on:
  1. Jenkins 1.6.2.1 to automate the launch of Ant and get the code from Github. Jenkins has been installed with:
    1. the Github plugin, to download the code from GitHub
    2. the Violation plugin, to monitor the JSLint errors (inside the lib/csslint/jslint.xml file) and CSSlint erros (inside the lib/jslint/csslint.xml file)
    3. the Xunit plugin, to monitor the result of the test execution; the Xunit plugin reads the xunit.xml file locatd in tests-execution folder which is generated by casperjs ant task.
    4. the HTML publisher plugin, to create a link to JSDOC (lib/jsdoc/output/global.html) and Sparql-doc (sparql-doc/index.html) files on the jenkins job.
  2. Ant 1.9.6, which executes the build.xml to automate all the development process
  3. jslint4java 2.0.5 which validates the javascript used by the validator accordingly to JSLint rules.
  4. csslint 0.10.0 (with rhino 1.7.6) to evaluate css errors
  5. jsdoc3-ant-task-1.0 to generate jsdoc documentation
  6. sparql-doc 0.0.4 which generates HTML documentation based on rules (SPARQL queries). Sparql-doc is installed on Windows machine after Railsinstaller 2.2.5 for Ruby 1.9 (required by sparql-doc) with the command:gem install sparql-doc
  7. YUI compressor to compress css and javascript files
  8. Jquery UI to display tabs
  9. Codemirror for syntax highlight in direct input tab and in the SPARQL query text area
  10. DataTables 1.10 to display results with ordering, pagination and search.
  11. casperjs 1.1 beta (based on phantomjs 1.9.2) to execute all the tests.
  12. Node v4.2.1 for server requests with module request.
  13. JavaScript Cookie v2.0.3 for cookie management.

TO DO

ActionPriorityStatus
Add compatibility with virtuoso, see api at: http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtGraphProtocolCURLExamplesHighNot done
Add automatic tests for file url and direct inputMediumNot done
Improve quality of the tests: parametrize comments, categorization by node (dataset, agent, etc.)MediumNot done
Add toggle columns in the results (in case more data are returned->better queries)MediumNot done
Add possible html compressor such as: https://code.google.com/p/htmlcompressor/LowNot done
Homogenize css between build.css, dcat-ap_validator.css and dcat-ap_validator-results.cssLowNot done
Improve W3C and WCAG 2.0 validation for the resultsLowNot done

Licence

This software is released with EUPL licence: https://joinup.ec.europa.eu/community/eupl/home