summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--src/sord_validate.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 34d4497..9a09e09 100644
--- a/NEWS
+++ b/NEWS
@@ -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);