INCATools / dosdp-tools

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

Dealing with nominals and data values #305

Closed matentzn closed 3 years ago

matentzn commented 3 years ago

Right now, using this pattern does not work:

pattern_name: dron_1
pattern_iri: http://purl.obolibrary.org/obo/dron/patterns/dron_1.yaml

classes:
  scattered molecular aggregate: owl:Thing
  active ingredient: owl:Thing
  mass: owl:Thing
  part: owl:Thing
  milligram: owl:Thing

relations: 
  has_part: BFO:0000051
  has_measurement_unit_label: IAO:0000039
  has_granular_part: BFO:0000071
  is_bearer_of: BFO:0000053

annotationProperties:
  exact_synonym: oio:hasExactSynonym 

vars:
  part: "'part'"

dataProperties:
  has_specified_value: OBI:0001937

data_vars:
  ml: double

subClassOf:
  text: "'has_part' some ('scattered molecular aggregate' and ('is_bearer_of' some 'active ingredient') and ('is_bearer_of' some ('mass' and ('has_measurement_unit_label' value 'milligram') and ('has_specified_value' value %s))) and ('has_granular_part' some %s))"
  vars:
    - ml
    - part

Its hard to diagnose the exact root of the problem, but this is what I learned:

Seems to me

if I use this variant of the definition:

  text: "'has_part' some ('scattered molecular aggregate' and ('is_bearer_of' some 'active ingredient') and ('is_bearer_of' some ('mass' and ('has_measurement_unit_label' some 'milligram') and ('has_specified_value' value %s))) and ('has_granular_part' some %s))"

I get

org.semanticweb.owlapi.manchestersyntax.renderer.ParserException: Encountered '$ml' at line 1 column 214. Expected one of:
    $integer$
    "$Literal$"@<lang>

If I change this to

  text: "'has_part' some ('scattered molecular aggregate' and ('is_bearer_of' some 'active ingredient') and ('is_bearer_of' some ('mass' and ('has_measurement_unit_label' some 'milligram') and ('has_specified_value' some %s))) and ('has_granular_part' some %s))"

I get

scala.MatchError: DataSomeValuesFrom(<http://purl.obolibrary.org/obo/OBI_0001937> <urn:dosdp:ml>) (of class uk.ac.manchester.cs.owl.owlapi.OWLDataSomeValuesFromImpl)
    at org.monarchinitiative.dosdp.SPARQL$.triples(SPARQL.scala:170)
    at org.monarchinitiative.dosdp.SPARQL$.$anonfun$triples$13(SPARQL.scala:193)

@balhoff suspects that this features may simply not work yet.. Maybe @dosumis has an idea?

Note that milligram is an Individual, not a Class.. Not sure how else to declare it in the pattern?

matentzn commented 3 years ago

Seems this is simply due to the fact that individuals are not at all supported yet. Closing because need to make a better issue.