INCATools / dosdp-tools

Utility for working with DOSDP design patterns and OWL ontologies
MIT License
23 stars 5 forks source link

Bug - or improvements to exception handling needed for building prototypes owl #54

Open dosumis opened 5 years ago

dosumis commented 5 years ago

When building prototypes from here:

https://github.com/obophenotype/Pheno_odk_test/tree/master/src/patterns

dosdp-tools prototype --obo-prefixes --template=. --outfile=../patterns/pattern.owl

=>

Exception in thread "main" java.net.MalformedURLException: no protocol: . at java.net.URL.<init>(URL.java:593) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at scala.io.Source$.fromURL(Source.scala:131) at scala.io.Source$.fromURL(Source.scala:126) at org.monarchinitiative.dosdp.cli.Common.inputDOSDPFrom(Common.scala:50) at org.monarchinitiative.dosdp.cli.Common.inputDOSDPFrom$(Common.scala:47) at org.monarchinitiative.dosdp.cli.Prototype$.inputDOSDPFrom(Prototype.scala:14) at org.monarchinitiative.dosdp.cli.Prototype$.$anonfun$run$5(Prototype.scala:27) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234) at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:320) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:976) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:976) at scala.collection.TraversableLike.map(TraversableLike.scala:234) at scala.collection.TraversableLike.map$(TraversableLike.scala:227) at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47) at scala.collection.SetLike.map(SetLike.scala:101) at scala.collection.SetLike.map$(SetLike.scala:101) at scala.collection.AbstractSet.map(Set.scala:47) at org.monarchinitiative.dosdp.cli.Prototype$.run(Prototype.scala:27) at org.monarchinitiative.dosdp.cli.Main$.$anonfun$new$1(Main.scala:33) at org.monarchinitiative.dosdp.cli.Main$.$anonfun$new$1$adapted(Main.scala:33) at scala.Option.foreach(Option.scala:257) at org.monarchinitiative.dosdp.cli.Main$.delayedEndpoint$org$monarchinitiative$dosdp$cli$Main$1(Main.scala:33) at org.monarchinitiative.dosdp.cli.Main$delayedInit$body.apply(Main.scala:29) at scala.Function0.apply$mcV$sp(Function0.scala:34) at scala.Function0.apply$mcV$sp$(Function0.scala:34) at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) at scala.App.$anonfun$main$1$adapted(App.scala:76) at scala.collection.immutable.List.foreach(List.scala:389) at scala.App.main(App.scala:76) at scala.App.main$(App.scala:74) at org.monarchinitiative.dosdp.cli.Main$.main(Main.scala:29) at org.monarchinitiative.dosdp.cli.Main.main(Main.scala)

The '.' in the java.net.MalformedURLException seems to refer to the path to templates directory as I get '../patterns' in its place if running from src/ontology/Makefile.

The same command works when running via the Makefile on (or directly on a target) from the ontology_development_kit. The latter has only a single YAML file in src/patterns, so I assume the problem is due to one of the YAML files in Pheno_odk_test/tree/master/src/patterns but haven't (yet) tracked down which. If so, it would be great if the command could tell me which one (and what's wrong with it).

balhoff commented 5 years ago

It seems like it's trying to make a URL from the "." (which it does when the path is not a directory and doesn't match a local file). But when I try it locally, that doesn't happen—it should know that it's a directory.

dosumis commented 5 years ago

Worked out what was causing the problem - a text editor backup with a .yaml extension: .#abnormalLevelOfChemical.yaml. So is just an exception handling problem rather than a bug. Would be great if exception could name the problem file if any .yaml or .tsv fail to parse.

balhoff commented 5 years ago

Thanks! That helps quite a bit.

balhoff commented 5 years ago

Hmm, actually I can't reproduce any problem with a file with that name.