List-types in instances not properly checked
Type checking for list-arguments in instances is not checked correctly. E.g. the following pair of template and instance gives no error, although it should:
@prefix ex: <http://example.com/ns#> .
@prefix ottr: <http://ns.ottr.xyz/0.4/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ex:T[ List<xsd:string> ?l ] :: {
ottr:Triple(_:x, ex:r, ?l)
} .
and
@prefix ex: <http://example.com/ns#> .
@prefix ottr: <http://ns.ottr.xyz/0.4/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
ex:T( (ex:a, ex:b) ) .
This is caused by the following if-test in CheckingExpander:
if (!argType.isCompatibleWith(paramType)) {
messages.add(Message.error("Incompatible argument type. Argument " + argument
+ " with type " + argType
+ " given to parameter " + parameter));
}
The test only checks if the argument type, which for lists is NEList<LUB<rdfs:Resource>>
, is compatible with the argument type. However, we need to also check that the arguments within the list have a compatible type. This needs to be done at all levels, which may be a bit more involved, but could be done similarly as in the CheckLibrary
, except without the query languague.