From f5e6b2cded8fd778171213fbfecd4901cdf52e9f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 7 Feb 2017 22:21:31 +0100 Subject: Add support for maximum cardinality --- src/sord_validate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/sord_validate.c') diff --git a/src/sord_validate.c b/src/sord_validate.c index d88fd3f..8856d2f 100644 --- a/src/sord_validate.c +++ b/src/sord_validate.c @@ -54,6 +54,7 @@ typedef struct { SordNode* owl_Thing; SordNode* owl_cardinality; SordNode* owl_equivalentClass; + SordNode* owl_maxCardinality; SordNode* owl_minCardinality; SordNode* owl_onDatatype; SordNode* owl_onProperty; @@ -563,6 +564,19 @@ check_instance(SordModel* model, } } + // Check maximum cardinality + const SordNode* maxCard = sord_get( + model, restriction, uris->owl_maxCardinality, NULL, NULL); + if (maxCard) { + const unsigned m = atoi((const char*)sord_node_get_string(maxCard)); + if (values < m) { + st = errorf(quad, "Property %s on %s has %u > %u values", + sord_node_get_string(prop), + sord_node_get_string(instance), + values, m); + } + } + // Check someValuesFrom SordIter* sf = sord_search( model, restriction, uris->owl_someValuesFrom, NULL, NULL); @@ -710,6 +724,7 @@ main(int argc, char** argv) URI(owl, Thing); URI(owl, cardinality); URI(owl, equivalentClass); + URI(owl, maxCardinality); URI(owl, minCardinality); URI(owl, onDatatype); URI(owl, onProperty); -- cgit v1.2.1