Unable to find most specific common supertype

This forum is to report technical problems with Rel.
Post Reply
olivers
Posts: 3
Joined: Thu Jan 18, 2018 9:00 pm

Unable to find most specific common supertype

Post by olivers »

While trying to assign a tuple to a relvar I got the following error (with crash report):


ERROR: RS0383: Unable to find most specific common supertype.


Line 1052, column 179 near ''Comarca de San Blas''


org.reldb.rel.exceptions.ExceptionFatal: RS0383: Unable to find most specific common supertype.
Line 1052, column 179 near ''Comarca de San Blas''



at org.reldb.rel.v0.interpreter.Interpreter.interpret(Interpreter.java:222)
at org.reldb.rel.v0.interpreter.Interpreter.interpret(Interpreter.java:234)
at org.reldb.rel.v0.interpreter.Interpreter.interpret(Interpreter.java:238)
at org.reldb.rel.v0.engine.Rel$2.execute(Rel.java:131)
at org.reldb.rel.v0.engine.Rel.send(Rel.java:85)
at org.reldb.rel.v0.engine.Rel.sendExecute(Rel.java:129)
at org.reldb.rel.Rel.sendExecute(Rel.java:88)
at org.reldb.rel.client.connection.stream.ClientLocalConnection.sendExecute(ClientLocalConnection.java:39)
at org.reldb.rel.client.connection.string.ClientLocal.sendExecute(ClientLocal.java:57)
at org.reldb.dbrowser.ui.content.cmd.ConcurrentStringReceiverClient$1.doQuery(ConcurrentStringReceiverClient.java:163)
at org.reldb.dbrowser.ui.content.cmd.ConcurrentStringReceiverClient$Runner.lambda$2(ConcurrentStringReceiverClient.java:130)
at java.lang.Thread.run(Thread.java:748)


Cancel.



This is the line where the error is thrown:

TUPLE {Province PROVINCENAME('Comarca de San Blas'), Country COUNTRY('PA'), Population NOINTDATA(), Area INTDATA(2357), Capital CITYNAME('El Porvenir'), CapProv PROVINCENAME('Comarca de San Blas')}



The structure of the relvar looks like this:

VAR Province REAL RELATION {
Province PROVINCE,
Country COUNTRY,
Population INTEGERTYPE,
Area INTEGERTYPE,
Capital CITY,
CapProv PROVINCE
} KEY {Province, Country};



And if needed, here are the definition of the created types:

TYPE PROVINCE UNION;

TYPE PROVINCENAME IS {
PROVINCE POSSREP {
Province CHAR
}
};

TYPE NOPROVINCE IS {
PROVINCE POSSREP {}
};


TYPE COUNTRY POSSREP {
Country CHAR
};


TYPE INTEGERTYPE UNION;

TYPE INTDATA IS {
INTEGERTYPE POSSREP {
Number INTEGER
}
};

TYPE NOINTDATA IS {
INTEGERTYPE POSSREP {}
};


TYPE CITY UNION;

TYPE CITYNAME IS {
CITY POSSREP {
City CHAR
}
};

TYPE NOCITY IS {
CITY POSSREP {}
};



It's not the only tuple that causes an error, there are several other tuples at other relvars that cause this type of error.

I hope the error description is sufficent for you to be able to fix this problem.
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Unable to find most specific common supertype

Post by Dave »

Could you post the expression or statement that causes the error?

I tried inserting the problem tuple into the Province relvar and it works.

Thanks!
olivers
Posts: 3
Joined: Thu Jan 18, 2018 9:00 pm

Re: Unable to find most specific common supertype

Post by olivers »

Thank you for the fast reply!

I'm trying to recreate the Mondial database, so I put (hopefully) all the things you need into files in the attachments.


EDIT: Oops sorry, I uploaded a wrong version of the DML file.
Attachments
DML.txt
(304.22 KiB) Downloaded 154 times
DDL.txt
(1.09 KiB) Downloaded 163 times
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Unable to find most specific common supertype

Post by Dave »

That's helpful, and I'll try to provide a better solution. It's actually a limitation in how I've implemented the type inference, but it should be a semantic error rather than the fatal error it is now.

At a minimum, I'll update it to be a semantic error in the next release.

The solution/workaround is to provide an explicit relation heading specifying the most-specific common supertypes (which is usually the UNION type). E.g., this:

Code: Select all

Province := RELATION {Province PROVINCE, Country COUNTRY, Population INTEGERTYPE, Area INTEGERTYPE, Capital CITY, CapProv PROVINCE} {
    TUPLE {Province PROVINCENAME('Albania'), Country COUNTRY('AL'), Population INTDATA(3249136), Area NOINTDATA(), Capital CITYNAME('Tirane'), CapProv PROVINCENAME('Albania')},
    TUPLE {Province PROVINCENAME('Anatoliki Makedhonia kai Thraki'), Country COUNTRY('GR'), Population INTDATA(574308), Area INTDATA(14157), Capital CITYNAME('Komotini'), CapProv PROVINCENAME('Anatoliki Makedhonia kai Thraki')},
    TUPLE {Province PROVINCENAME('Attiki'), Country COUNTRY('GR'), Population INTDATA(3522769), Area INTDATA(3808), Capital CITYNAME('At ...
olivers
Posts: 3
Joined: Thu Jan 18, 2018 9:00 pm

Re: Unable to find most specific common supertype

Post by olivers »

That works, thanks for the help!

Keep up the good work!
Post Reply