ld4l-labs / bibliotek-o

bibliotek-o: a BIBFRAME 2 Extension Ontology
Creative Commons Zero v1.0 Universal
9 stars 8 forks source link

Hook up travis.ci #24

Open dazza-codes opened 7 years ago

dazza-codes commented 7 years ago

A continuous integration platform like travis.ci can automatically run tests on changes to the ontology. Possible tests include:

dazza-codes commented 7 years ago

Note, to use the OWL API it needs to be bundled into an application (it's just a java library). One such application is available from https://github.com/ontodev/robot

zimeon commented 7 years ago

@darrenleeweber -- How about a PR?

dazza-codes commented 7 years ago

Working on it....

dazza-codes commented 7 years ago

Need to enable a travis.ci switch somewhere to proceed with the PR. I don't have permission to commit directly to this repo and probably not to enable travis - help required?

dazza-codes commented 7 years ago

Testing the travis functionality where I have permissions to enable it, i.e.

zimeon commented 7 years ago

Travis enabled for this repo (will need to push some update)

dazza-codes commented 7 years ago

Travis working on the SUL-DLSS PR, but it only runs robot help at this point. Need to decide how to run robot on the ontology.

$ ./tools/robot help

usage: robot [command] [options] <arguments>

 -h,--help                  print usage information
 -noprefixes                do not use default prefixes
 -p,--prefix <arg>          add a prefix 'foo: http://bar'
 -P,--prefixes <arg>        use prefixes from JSON-LD file
 -V,--version               print version information
 -v,--verbose               increased logging
 -vv,--very-verbose         high logging
 -vvv,--very-very-verbose   maximum logging
 -x,--xml-entities          use entity substitution with ontology XML
                            output

commands:

 help             print help for command
 annotate         annotate ontology
 convert          convert ontology
 diff             find the differences between two ontologies
 export-prefixes  export prefixes to a file
 extract          extract terms from an ontology
 filter           filter ontology axioms
 materialize      materialize ontology
 merge            merge ontologies
 mirror           mirror ontology imports closure
 query            query an ontology
 reason           reason ontology
 reduce           reduce ontology
 relax            relax ontology
 template         build an ontology from a template
 unmerge          unmerge ontologies
 validate-profile validate ontology against an OWL profile
zimeon commented 7 years ago

I don't know robot but what does the validate-profile option do?

dazza-codes commented 7 years ago

OWL has several profiles and, in theory, robot can check an ontology to validate whether it conforms to a profile or not. In general, robot help {command} provides more details, e.g.

$ ./tools/robot help validate-profile
usage: robot validate-profile --profile <profile> --output <file>
 -h,--help                  print usage information
 -i,--input <arg>           validate ontology from a file
 -I,--input-iri <arg>       validate ontology from an IRI
 -noprefixes                do not use default prefixes
 -o,--output <arg>          save validation report to a file
 -p,--profile <arg>         OWL profile to validate (DL, EL, RL, QL, or Full)
 -P,--prefixes <arg>        use prefixes from JSON-LD file
 -V,--version               print version information
 -v,--verbose               increased logging
 -vv,--very-verbose         high logging
 -vvv,--very-very-verbose   maximum logging
 -x,--xml-entities          use entity substitution with ontology XML output

In testing this, I tried the Full profile, but it looks like robot is ignoring that command line option and running a validator on the DL profile no matter what. This ontology does not seem to validate against the DL profile - or at least there is a lot of output about stuff that might be a problem. So, at first, I avoided the complications but would like to address this question somehow.

dazza-codes commented 7 years ago

Maybe I just don't understand how robot validation works - it seems to output a lot of stuff but the return status might be OK (i.e. 0), e.g.

$ ./tools/robot validate-profile -i ./target-ontologies/bibliotek-o.owl -p DL && echo 'OK'
OWL 2 DL Profile Report: Ontology and imports closure NOT in profile. The following violations are present:
Use of undeclared annotation property: <http://purl.org/dc/terms/modified> in annotation [Annotation(<http://purl.org/dc/terms/mod
ified> "2017-04-22T00:00:00-04:00") in AnnotationAssertion(<http://purl.org/dc/terms/modified> <http://bibliotek-o.org/ontology/ad
dedTitlePage> "2017-04-22T00:00:00-04:00")]

... snipped tons of output like the following:
Use of undeclared annotation property: <http://purl.org/dc/terms/modified> in annotation [Annotation(<http://purl.org/dc/terms/modified> "2017-04-22T00:00:00-04:00") in AnnotationAssertion(<http://purl.org/dc/terms/modified> <http://bibliotek-o.org/ontology/AccessibilityHazard> "2017-04-22T00:00:00-04:00")]

OK

Basically the same thing, just checking the return status/value is zero (which means "success" in unix, but does that mean the validation is good? I dunno.):

$ ./tools/robot validate-profile -i ./target-ontologies/bibliotek-o.owl -p DL
... snipped tons of output ...
$ echo $?
0

A test on the validation might have to capture the output and grep it for some kind of content that confirms the validation.

dazza-codes commented 7 years ago

See also related issues on robot at

rjyounes commented 7 years ago

I would expect that you would have tested this before making the PR.

rjyounes commented 7 years ago

I have reverted the commits until this has been tested. In addition, it was mistakenly committed to master rather than develop.

dazza-codes commented 7 years ago

It is tested. The fact that robot can convert the ontology means that it can parse it as an OWL ontology. There was discussion at the LD4* meeting that bioportal could not load it and I decided to use robot as an OWL API wrapper to check that it can parse/convert the ontology and have this done by travis.ci automatically. This is all working, please do not revert that work.

I'm not familiar with reverting a merged PR and the unilateral decision to do so, and what to do about trying to get it back again. I would appreciate discussion about a proposed revert before actually doing a revert. So, I'm proposing that the revert is undone, because the merge practice that I'm familiar with includes deleting a branch that is merged. So it's not immediately obvious to me how to get it back without doing it all over again.

In general, I'm familiar with master being the target of PRs. It is usually the default branch. If the develop branch should be the default target for PRs because master is used for something else (releases), then please consider making develop the default branch. Also describe any unconventional branch practices on the README (if not there already).

zimeon commented 7 years ago

@darrenleeweber - looks like you found restore button on github to get the branch back and made a new PR ;-)

Perhaps a discussion would be in order before going ahead with implementing this so that everyone is on the same page about what this does and does not do? Perhaps also some documentation would make sense too, to help those not familiar with robot, and to flag any possible gotchas as we maintain the ontology?

rjyounes commented 7 years ago

Develop is now the default branch. We are following a standard branching model in which master is the release branch and all changes are committed to develop first. Develop is merged to master once the branch is ready for release.

@zimeon Thanks for suggesting a discussion before the PR is acted on. I would like to understand the nature of the technology before adopting it into the project.

dazza-codes commented 7 years ago

In the next few months, I will be reallocated to HyBox efforts. I proposed this issue as a broad discussion about using travis to perform automatic checks on the ontology. I also did some work to create the PR that demonstrates one way that this can be done. I would appreciate merging that work as an agile first step in this direction. Additional work/PR may replace or revise this first step. It is working as expected. I may not have much time to devote to a complete education and investigation process on the best possible solution(s), but I would appreciate merging this first contribution in this direction. In essence, using robot is simply a wrapper on the OWL-API (which is just a java library, not a command line utility) and the current PR uses it to effectively parse and convert the ontology (the parsing bit is the most important). The robot developers are actively maintaining and using the project, so it is a utility that can and does respond to feature requests or bug fixes; basically I recommend using it for this purpose.