Giter VIP home page Giter VIP logo

owlint's Introduction

owLint Build Status

owLint is a configurable command line OWL file linter. It utilizes the OWL API.

owLint is distributed as a tool through npm. Install owLint globally via the following command: npm install -g owlint.

Usage

owLint will look in the defined directory for a .owlint configuration file and .owl files to lint.

An example .owlint file is seen below

{
  "ontology-must-have-version-info" : true,
  "ontology-must-have-dc-title" : true,
  "ontology-must-have-dc-creator" : true,
  "ontology-must-have-only-one-dc-creator" : true,
  "ontology-must-have-only-one-dc-contributor" : true,
  "ontology-must-have-dc-date" : true,
  "entities-must-have-rdfs-comment" : true,
  "iris-and-labels-are-unique" : true,
  "non-root-classes-need-genus-differentiation" : true
}

A .owlint file is optional. By default all of the tests are enabled.

owLint can also be passed a single file to lint instead of an entire directory. If there is a .owlint file in the directory containing the passed in file then that .owlint file will be used instead of the default.

The output to owlint -h is shown below:

owLint: OWL file linting tool 
This tool takes an optional argument, the path to the file to lint or to the folder containing the owl files in question.
Examples:
   $ owlint                             | Use current directory
   $ owlint owlFileFolder               | Use ./owlFileFolder as the directory
   $ owlint /home/username/somedir      | Use absolute path /home/username/somedir as the directory
   $ owlint someOwlFile.owl             | Only lint someOwlFile.owl (You can also use absolute paths for files)
   $ owlint -h | -help                  | Displays help information

List of Options

Ontology

ontology-must-have-version-info

Each owl:Ontology must have an owl:versionInfo annotation property.

ontology-must-have-dc-title

Each owl:Ontology must have a dc:title annotation property.

ontology-must-have-dc-creator

ontology-must-have-only-one-dc-creator

Each dc:creator annotation can only have one name listed in the annotation. It is impossible to perfectly enforce this rule, but this can catch the most common ways people try to place more than one person into a single dc:creator annotation.

This test will fail if the dc:creator annotation contains any of the following:

  • new line,
  • carriage return,
  • tab,
  • vertical tab,
  • /,
  • _,
  • |,
  • " and " (Notice the spaces padding the word. This is done to make sure that someone who has the substring and in their name will not make this lint fail).

Entities

entities-must-have-rdfs-comment

All classes, individuals, object properties, data properties, and annotation properties defined within the currently linted IRI namespace must have rdfs:comment annotations.

Classes

non-root-classes-need-genus-differentiation

All non-root classes (Each owl:class with an rdfs:subclassOf statement) need to have a statement differentiating between other owl:classes that are also subclasses of the same parent owl:class. An example genus differentating statement takes the form: rdfs:subClassOf <Object Property> <Quantifier> <named owl:class or anonymous class>

General

iris-and-labels-are-unique

The human readable portion of IRIs and rdfs:labels must be a unique set.

Example of what would trigger a failure:

  <owl:Class rdf:about="#Cajun">
...
    <rdfs:label xml:lang="pt">Cajun</rdfs:label>
...
  </owl:Class>

Development

Compliling

sbt compile

Building and Running

sbt "run -help"

Testing

sbt test

Adding additional linter options

To add your linter function add the function and full text description to the lintTestMappings Map.

The linter function you add must be in the following format:

def superCoolLinterTest (ontology: OWLOntology): LintFunctionResult = {/**/}

If you add an additional option please add relevant tests.

Screenshots

screenshot

owlint's People

Contributors

de-husk avatar

Stargazers

yves peeters avatar Josh Hanna avatar

Watchers

James Cloos avatar  avatar

owlint's Issues

Allow to specify a specific file

Steps that will reproduce the problem?

  1. owlint file.ttl

What is the expected result?
Check file.ttl

What happens instead?
file.ttl is not a real directory

Possible workaround:
Rename file.ttl to folder/file.owl and run owlint folder

Any additional information:

Set exit code

Steps that will reproduce the problem?

  1. owlint folder

What is the expected result?
A proper exist code.

What happens instead?
Always 0.

Possible workaround:
Parse the output.

Any additional information:

$ owlint folder; echo $?
...
Lint Failed!!

------------------------------
Lint Error: 
...
0

Number of DC creators not counted correctly

Command: $ owlint a|grep "DC creator" -A2 -B1 && grep -HIirns "creator" a
Lint:

Lint Error: 
    Reason For Failure: The ontology cannot have more than one DC creator listed in the dc:creator annotation.
    Number of offenses: 1
    [AnnotationProperty]    http://purl.org/dc/elements/1.1/creator

Grep:

a/omn.owl:48:                                         dc:creator <http://alex.willner.ws/about#me> ;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.