diff options
author | David Robillard <d@drobilla.net> | 2017-02-07 22:21:31 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-02-07 22:21:44 +0100 |
commit | f5e6b2cded8fd778171213fbfecd4901cdf52e9f (patch) | |
tree | f3f4ee3d6fa11d38369c195007c2ad9ce94c9d25 /src/sord_validate.c | |
parent | 59b708654825333ee944495dd5f892299c25a6a9 (diff) | |
download | sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.tar.gz sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.tar.bz2 sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.zip |
Add support for maximum cardinality
Diffstat (limited to 'src/sord_validate.c')
-rw-r--r-- | src/sord_validate.c | 15 |
1 files changed, 15 insertions, 0 deletions
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); |