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 | |
parent | 59b708654825333ee944495dd5f892299c25a6a9 (diff) | |
download | sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.tar.gz sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.tar.bz2 sord-f5e6b2cded8fd778171213fbfecd4901cdf52e9f.zip |
Add support for maximum cardinality
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/sord_validate.c | 15 |
2 files changed, 17 insertions, 1 deletions
@@ -2,8 +2,9 @@ sord (0.16.1) unstable; * sord_validate: Fix restriction count reporting * sord_validate: Use consistent error format + * sord_validate: Add support for maximum cardinality - -- David Robillard <d@drobilla.net> Tue, 07 Feb 2017 22:17:34 +0100 + -- David Robillard <d@drobilla.net> Tue, 07 Feb 2017 22:21:10 +0100 sord (0.16.0) stable; 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); |