INCATools / dosdp-tools

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

Error when trying to match unions #138

Closed matentzn closed 5 years ago

matentzn commented 5 years ago

I am currently trying to match this pattern:

equivalentTo:
  text: "%s and ('inheres_in' some (%s or %s)) and ('has_modifier' some 'abnormal')"
  vars:
    - quality
    - entity
    - entity2

using dosdp-query, but I am getting:

Exception in thread "main" scala.NotImplementedError: an implementation is missing
    at scala.Predef$.$qmark$qmark$qmark(Predef.scala:288)
    at org.monarchinitiative.dosdp.SPARQL$.triples(SPARQL.scala:114)
    at org.monarchinitiative.dosdp.SPARQL$.triples(SPARQL.scala:98)
    at org.monarchinitiative.dosdp.SPARQL$.$anonfun$triples$7(SPARQL.scala:106)
    at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237)
    at scala.collection.Iterator.foreach(Iterator.scala:941)
    at scala.collection.Iterator.foreach$(Iterator.scala:941)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
    at scala.collection.IterableLike.foreach(IterableLike.scala:74)
    at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
    at scala.collection.TraversableLike.map(TraversableLike.scala:237)
    at scala.collection.TraversableLike.map$(TraversableLike.scala:230)
    at scala.collection.mutable.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:48)
    at scala.collection.SetLike.map(SetLike.scala:104)
    at scala.collection.SetLike.map$(SetLike.scala:104)
    at scala.collection.mutable.AbstractSet.map(Set.scala:48)
    at org.monarchinitiative.dosdp.SPARQL$.triples(SPARQL.scala:105)
    at org.monarchinitiative.dosdp.SPARQL$.$anonfun$triples$2(SPARQL.scala:75)
    at scala.Option.map(Option.scala:163)
    at org.monarchinitiative.dosdp.SPARQL$.$anonfun$triples$1(SPARQL.scala:72)
    at scala.Option.flatMap(Option.scala:188)
    at org.monarchinitiative.dosdp.SPARQL$.triples(SPARQL.scala:71)
    at org.monarchinitiative.dosdp.SPARQL$.$anonfun$triplesFor$1(SPARQL.scala:49)
    at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:244)
    at scala.collection.Iterator.foreach(Iterator.scala:941)
    at scala.collection.Iterator.foreach$(Iterator.scala:941)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
    at scala.collection.IterableLike.foreach(IterableLike.scala:74)
    at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
    at scala.collection.TraversableLike.flatMap(TraversableLike.scala:244)
    at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:241)
    at scala.collection.AbstractTraversable.flatMap(Traversable.scala:108)
    at org.monarchinitiative.dosdp.SPARQL$.triplesFor(SPARQL.scala:49)
    at org.monarchinitiative.dosdp.SPARQL$.queryFor(SPARQL.scala:23)
    at org.monarchinitiative.dosdp.cli.Query$.run(Query.scala:27)
    at org.monarchinitiative.dosdp.cli.Main$.$anonfun$new$1(Main.scala:10)
    at org.monarchinitiative.dosdp.cli.Main$.$anonfun$new$1$adapted(Main.scala:10)
    at scala.Option.foreach(Option.scala:274)
    at org.monarchinitiative.dosdp.cli.Main$.delayedEndpoint$org$monarchinitiative$dosdp$cli$Main$1(Main.scala:10)
    at org.monarchinitiative.dosdp.cli.Main$delayedInit$body.apply(Main.scala:6)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1$adapted(App.scala:80)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at scala.App.main(App.scala:80)
    at scala.App.main$(App.scala:78)
    at org.monarchinitiative.dosdp.cli.Main$.main(Main.scala:6)
    at org.monarchinitiative.dosdp.cli.Main.main(Main.scala)

This is not toptop of the list of priorities, but it would be nice if this worked, especially in the light of Chris attempt to write up the use case scenarios for patterns.

cmungall commented 5 years ago

+1

I'm running into the same issue myself, although I get

dosdp-tools query --obo-prefixes --template=examples/sweet/X_or_X.yaml --ontology=examples/sweet/_input.ttl --outfile=examples/sweet/X_or_X.tsv
2019-07-15 17:40:41,226 ERROR org.monarchinitiative.dosdp.cli.Query$ - Failed to parse pattern:
[K, V]Map[K, V]: DownField(relations)
[K, V]Map[K, V]: DownField(relations)
Exception in thread "main" DecodingFailure([K, V]Map[K, V], List(DownField(relations)))

files here:

https://github.com/cmungall/owl_patternizer/tree/master/examples/sweet

I would just translate unions into a SPARQL union here, no reasoning