INCATools / dosdp-tools

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

new annotation matching features fails in one case #284

Closed matentzn closed 3 years ago

matentzn commented 3 years ago
../dosdp-tools-0.16-SNAPSHOT/bin/dosdp-tools query --ontology=mondo-edit.obo --catalog=catalog-v001.xml --reasoner=elk --restrict-axioms-to=annotation --obo-prefixes=true --batch-patterns=".." --template="../patterns/dosdp-patterns" --outfile="../patterns/data/matches_annotations/"

Failing pattern:

https://github.com/monarch-initiative/mondo/blob/master/src/patterns/dosdp-patterns/vectorBorneDisease.yaml

@balhoff and I believe it could be the dash in the definition:

def:
    text: '%s-borne %s.'
    vars:
      - vector
      - infectious_disease

Error:

020.12.23 11:53:32:893 [INFO ] org.monarchinitiative.dosdp.cli.Query.run:40 - Processing pattern ../patterns/dosdp-patterns/vectorBorneDisease.yaml
Fiber failed.
An unchecked error was produced.
org.apache.jena.query.QueryParseException: Encountered " "-" "- "" at line 22, column 15.
Was expecting:
    "{" ...
    at org.apache.jena.sparql.lang.ParserARQ.perform(ParserARQ.java:100)
    at org.apache.jena.sparql.lang.ParserARQ.parse$(ParserARQ.java:52)
    at org.apache.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34)
    at org.apache.jena.query.QueryFactory.parse(QueryFactory.java:150)
    at org.apache.jena.query.QueryFactory.create(QueryFactory.java:82)
    at org.apache.jena.query.QueryFactory.create(QueryFactory.java:55)
    at org.apache.jena.query.QueryFactory.create(QueryFactory.java:43)
    at org.phenoscape.owlet.Owlet.expandQueryString(Owlet.scala:34)
    at org.monarchinitiative.dosdp.cli.Query$.$anonfun$makeProcessedQuery$1(Query.scala:65)
    at scala.Option.map(Option.scala:242)
    at org.monarchinitiative.dosdp.cli.Query$.makeProcessedQuery(Query.scala:64)
    at org.monarchinitiative.dosdp.cli.Query$.$anonfun$createQuery$2(Query.scala:60)
    at zio.ZIO$MapFn.apply(ZIO.scala:4142)
    at zio.ZIO$MapFn.apply(ZIO.scala:4140)
    at zio.internal.FiberContext.evaluateNow(FiberContext.scala:916)
    at zio.internal.FiberContext.$anonfun$evaluateLater$1(FiberContext.scala:778)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Fiber:Id(1608723692702,1) was supposed to continue to:
  a future continuation at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:41)
  a future continuation at zio.ZIO$.foreach(ZIO.scala:2808)
  a future continuation at zio.ZIO.zipWith(ZIO.scala:2137)
  a future continuation at zio.ZIO.zipWith(ZIO.scala:2137)
  a future continuation at zio.ZIO.zipWith(ZIO.scala:2137)
  a future continuation at zio.ZIO$.foreach(ZIO.scala:2809)
  a future continuation at zio.ZIO.run(ZIO.scala:1640)
  a future continuation at zio.ZManaged.use(ZManaged.scala:1025)
  a future continuation at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:38)
  a future continuation at zio.ZIO.exitCode(ZIO.scala:543)
Fiber:Id(1608723692702,1) execution trace:
  at org.monarchinitiative.dosdp.cli.Query$.createQuery(Query.scala:60)
  at org.monarchinitiative.dosdp.cli.CommonOptions.prefixesMap(Config.scala:70)
  at org.monarchinitiative.dosdp.cli.CommonOptions.prefixesMap(Config.scala:70)
  at org.monarchinitiative.dosdp.cli.Query$.createQuery(Query.scala:59)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:165)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at zio.ZIO$.fromEither(ZIO.scala:3098)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at zio.ZIO$.fromEither(ZIO.scala:3098)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:162)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:161)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2640)
  at zio.ZIO$.bracketExit(ZIO.scala:2273)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto$extension(ZIO.scala:3966)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto(ZIO.scala:3966)
  at zio.ZIO.run(ZIO.scala:1640)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:162)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:162)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:160)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:159)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:159)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:159)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:159)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:159)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:158)
  at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:41)
  at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:40)
  at zio.ZIO.zipWith(ZIO.scala:2137)
  at zio.ZIO$.foreach(ZIO.scala:2808)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:79)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:76)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:161)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2640)
  at zio.ZIO$.bracketExit(ZIO.scala:2273)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto$extension(ZIO.scala:3966)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto(ZIO.scala:3966)
  at zio.ZIO.run(ZIO.scala:1640)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at zio.ZIO$.foreach(ZIO.scala:2809)
  at zio.ZIO$.foreach(ZIO.scala:2807)
  at org.monarchinitiative.dosdp.cli.Query$.writeQueryResults(Query.scala:83)
  at org.monarchinitiative.dosdp.cli.Query$.writeQueryResults(Query.scala:83)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:77)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:76)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:76)
  at zio.ZIO$.fromEither(ZIO.scala:3098)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:75)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:74)
  at zio.ZIO$ZIOWithFilterOps$.withFilter(ZIO.scala:4022)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:125)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:161)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at zio.ZIO$.effectSuspendTotal(ZIO.scala:2640)
  at zio.ZIO$.bracketExit(ZIO.scala:2273)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto$extension(ZIO.scala:3966)
  at zio.ZIO$ZIOAutoCloseableOps$.bracketAuto(ZIO.scala:3966)
  at zio.ZIO.run(ZIO.scala:1640)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:154)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:119)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:118)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:117)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:117)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:116)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:115)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:115)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:113)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:113)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:113)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:113)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:112)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:107)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:107)
  at org.monarchinitiative.dosdp.cli.Query$.performQuery(Query.scala:107)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:74)
  at zio.ZIO.orElseFail(ZIO.scala:1080)
  at zio.ZIO$.fromOption(ZIO.scala:3211)
  at org.monarchinitiative.dosdp.cli.Query$.processTarget(Query.scala:73)
  at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:41)
  at org.monarchinitiative.dosdp.cli.Query$.createQuery(Query.scala:60)
  at org.monarchinitiative.dosdp.cli.CommonOptions.prefixesMap(Config.scala:70)
  at org.monarchinitiative.dosdp.cli.CommonOptions.prefixesMap(Config.scala:70)
  at org.monarchinitiative.dosdp.cli.Query$.createQuery(Query.scala:59)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:165)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at zio.ZIO$.fromEither(ZIO.scala:3098)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:164)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at zio.ZIO$.fromEither(ZIO.scala:3098)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:163)
  at org.monarchinitiative.dosdp.cli.Config$.inputDOSDPFrom(Config.scala:162)
  at zio.internal.FiberContext$InterruptExit$.apply(FiberContext.scala:161)
Fiber:Id(1608723692702,1) was spawned by:
Fiber:Id(1608723692573,0) was supposed to continue to:
  a future continuation at zio.App.main(App.scala:57)
  a future continuation at zio.App.main(App.scala:56)
Fiber:Id(1608723692573,0) ZIO Execution trace: <empty trace>
Fiber:Id(1608723692573,0) was spawned by: <empty trace>
mondo.Makefile:27: recipe for target 'matches_annotations' failed
make: *** [matches_annotations] Error 1
jdr0887 commented 3 years ago

@balhoff I think the solution here is to change S+ to w+ in the following:

https://github.com/INCATools/dosdp-tools/blob/e0e824afcd10d6b7369cc8413433dca3d710470b/src/main/scala/org/monarchinitiative/dosdp/SPARQL.scala#L138

w+ is any non-word character ([a-zA-Z_0-9])

I am thinking that this would work only if the token (%s) is separated from any following text by a non-word character (eg, %s123borne would cause an error & %s-borne would not).

Is this reasonable?

balhoff commented 3 years ago

@jdr0887 I like this idea. One problem is we don't have any constraints on the syntax of variable names. Perhaps we could include a restriction to regex word characters in the spec. Currently there's nothing stopping someone using a hyphen in their variable name. @matentzn @dosumis what do you think? Can we add to the spec that variable names must include only the characters [a-zA-Z_0-9] (letters, digits, underscore)?

matentzn commented 3 years ago

100% reasonable! that exact regex is fine! @dosumis needs to add it to the validator script though.

dosumis commented 3 years ago

https://github.com/INCATools/dead_simple_owl_design_patterns/issues/57

balhoff commented 3 years ago

Thanks, I'll go ahead and accept Jason's PR then.

balhoff commented 3 years ago

Fixed by #286.