summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/sord_validate.c39
2 files changed, 29 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index fe6c359..193298c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,13 @@ sord (0.10.5) unstable;
* Update to waf 1.7.8 and autowaf r90 (install docs to versioned directory)
* Add sord_node_get() for easily getting single property values
+ * sord_validate: Pass type check when range is xsd:anyURI and value is a URI
+ * sord_validate: Support any subClassOf rdf:Property, not just baked-in ones
* sordmm.hpp: Add convenient constructors for decimal and integer literals
* sordmm.hpp: Add Node::to_serd_node()
* sordmm.hpp: Don't automatically add RDF namespace prefix to world
- -- David Robillard <d@drobilla.net> Mon, 14 Jan 2013 01:52:25 -0500
+ -- David Robillard <d@drobilla.net> Sun, 27 Jan 2013 12:30:50 -0500
sord (0.10.4) stable;
diff --git a/src/sord_validate.c b/src/sord_validate.c
index 2418b87..d7fc043 100644
--- a/src/sord_validate.c
+++ b/src/sord_validate.c
@@ -63,6 +63,7 @@ typedef struct {
SordNode* rdfs_domain;
SordNode* rdfs_range;
SordNode* rdfs_subClassOf;
+ SordNode* xsd_anyURI;
SordNode* xsd_decimal;
SordNode* xsd_maxInclusive;
SordNode* xsd_minInclusive;
@@ -349,6 +350,12 @@ check_type(SordModel* model,
} else if (sord_node_get_type(node) == SORD_URI) {
if (sord_node_equals(type, uris->foaf_Document)) {
return true; // Questionable...
+ } else if (is_descendant_of(
+ model, uris,
+ type, uris->xsd_anyURI, uris->owl_onDatatype)) {
+ /* Type is any URI and this is a URI, so pass. Restrictions on
+ anyURI subtypes are not currently checked (very uncommon). */
+ return true; // Type is anyURI, and this is a URI
} else {
SordIter* t = sord_search(model, node, uris->rdf_type, NULL, NULL);
for (; !sord_iter_end(t); sord_iter_next(t)) {
@@ -446,6 +453,7 @@ main(int argc, char** argv)
URI(rdfs, domain);
URI(rdfs, range);
URI(rdfs, subClassOf);
+ URI(xsd, anyURI);
URI(xsd, decimal);
URI(xsd, maxInclusive);
URI(xsd, minInclusive);
@@ -465,24 +473,29 @@ main(int argc, char** argv)
const SordNode* pred = quad[SORD_PREDICATE];
const SordNode* obj = quad[SORD_OBJECT];
- bool is_Property = sord_ask(
- model, pred, uris.rdf_type, uris.rdf_Property, 0);
- bool is_OntologyProperty = sord_ask(
- model, pred, uris.rdf_type, uris.owl_OntologyProperty, 0);
- bool is_ObjectProperty = sord_ask(
+ bool is_any_property = false;
+ SordIter* t = sord_search(model, pred, uris.rdf_type, NULL, NULL);
+ for (; !sord_iter_end(t); sord_iter_next(t)) {
+ if (is_descendant_of(model, &uris,
+ sord_iter_get_node(t, SORD_OBJECT),
+ uris.rdf_Property,
+ uris.rdfs_subClassOf)) {
+ is_any_property = true;
+ break;
+ }
+ }
+ sord_iter_free(t);
+
+ const bool is_ObjectProperty = sord_ask(
model, pred, uris.rdf_type, uris.owl_ObjectProperty, 0);
- bool is_FunctionalProperty = sord_ask(
+ const bool is_FunctionalProperty = sord_ask(
model, pred, uris.rdf_type, uris.owl_FunctionalProperty, 0);
- bool is_InverseFunctionalProperty = sord_ask(
+ const bool is_InverseFunctionalProperty = sord_ask(
model, pred, uris.rdf_type, uris.owl_InverseFunctionalProperty, 0);
- bool is_DatatypeProperty = sord_ask(
+ const bool is_DatatypeProperty = sord_ask(
model, pred, uris.rdf_type, uris.owl_DatatypeProperty, 0);
- bool is_AnnotationProperty = sord_ask(
- model, pred, uris.rdf_type, uris.owl_AnnotationProperty, 0);
- if (!is_Property && !is_OntologyProperty && !is_ObjectProperty &&
- !is_FunctionalProperty && !is_InverseFunctionalProperty &&
- !is_DatatypeProperty && !is_AnnotationProperty) {
+ if (!is_any_property) {
error("Use of undefined property", quad);
}