AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

Missing feature in Haskell's Excel importer #1465

Open stefjoosten opened 5 months ago

stefjoosten commented 5 months ago

What happened

Ampersand-v5.0.0 [feature/labels-in-ADL-files:662580d51] produces no compile-time errors nor warnings when compiling this script:

CONTEXT Issue1465Test IN DUTCH

CLASSIFY Auto ISA Voertuig
RELATION eigenaar [Voertuig * Persoon] [UNI,TOT]
RELATION aantalWielen [ Auto * Getal]  [UNI,TOT]

REPRESENT Getal TYPE INTEGER

POPULATION eigenaar CONTAINS
  [ ("wagen1", "Piet") ,
    ("boot2", "marie") ]
POPULATION aantalWielen CONTAINS
  [ ("wagen1", 3)  ]
ENDCONTEXT

However, when I compile this:

CONTEXT Issue1465Test IN DUTCH
INCLUDE "Issue1465Test.xlsx"
CLASSIFY Auto ISA Voertuig
RELATION eigenaar [Voertuig * Persoon] [UNI,TOT]
RELATION aantalWielen [ Auto * Getal]  [UNI,TOT]

REPRESENT Getal TYPE INTEGER
ENDCONTEXT

with this spreadsheet:

afbeelding

I get the following error:

PropertyRule for TOT_aantalWielen[Auto*Getal] which is defined at /Users/sjo00577/git/Ampersand/testing/Sentinel/Tests/NoSentinel/Issue1465Test.adl:5:1 error:
  There is a violation of RULE TOT_5610962804479243845:
    ("wagen1", "wagen1")
ExitFailure 10

What I expected

I expected this to work because the population in the spreadsheet is identical to the population in the first script.

Version of Ampersand that was used

Steps to reproduce

  1. Compile both scripts with "ampersand check"
  2. Notice that the first is correct and the second produces a violation of the totality.

Workaround

I found a workaround. When the concepts Auto and Voertuig are each given a separate sheet in Excel, the thing behaves correctly. However, I don't want to be forced to use this workaround. I want the obvious thing to work correctly too.

stefjoosten commented 5 months ago

@hanjoosten, I added two files, Issue1465Test.adl and Issue1465Test.xlsx to the directory testing/Sentinel/Tests/Nosentinel, to ensure that these files can go into the regression test set once this issue is fixed.