Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle units properly if no QUDT-work is done
  • Loading branch information
egonw committed May 25, 2012
1 parent 97b61a8 commit 59af150
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions activities.groovy
Expand Up @@ -81,7 +81,10 @@ sql.eachRow(allMolregno) { row ->

// now do the units: check if we need to use QUDT and if we normalize
units = row.standard_units
if (unitMappings.containsKey(units)) {
if (units == null) {
// use the old approach, but only give the value
con.add(actURI, factory.createURI(ONTO + "standardValue"), factory.createLiteral((float)row.standard_value))
} else if (unitMappings.containsKey(units)) {
// use qudt:QuantityValue
quantityValue = factory.createURI(ACT + "a" + row.activity_id + "/standardValue")
con.add(actURI, factory.createURI(ONTO + "hasStandardValue"), quantityValue)
Expand Down Expand Up @@ -114,7 +117,7 @@ sql.eachRow(allMolregno) { row ->
} else {
// use the old approach
con.add(actURI, factory.createURI(ONTO + "standardValue"), factory.createLiteral((float)row.standard_value))
con.add(actURI, factory.createURI(ONTO + "standardUnits"), factory.createLiteral(row.units))
con.add(actURI, factory.createURI(ONTO + "standardUnits"), factory.createLiteral(units))
}
}

Expand Down

0 comments on commit 59af150

Please sign in to comment.