5.13.5 Validator¶
-
enum SerdValidatorCheck¶
A check that a validator can perform against a model.
-
enumerator SERD_CHECK_NOTHING¶
Checks nothing and always succeeds (for use as a sentinel)
-
enumerator SERD_CHECK_ALL_VALUES_FROM¶
Checks that all properties with owl:allValuesFrom restrictions have valid value types.
-
enumerator SERD_CHECK_ANY_URI¶
Checks that the value of any property with range xsd:anyURI is a URI.
-
enumerator SERD_CHECK_CARDINALITY_EQUAL¶
Checks that any instance of a class with a owl:cardinality property restriction has exactly that many values of that property.
-
enumerator SERD_CHECK_CARDINALITY_MAX¶
Checks that any instance of a class with a owl:maxCardinality property restriction has no more than that many values of that property.
-
enumerator SERD_CHECK_CARDINALITY_MIN¶
Checks that any instance of a class with a owl:minCardinality property restriction has at least that many values of that property.
-
enumerator SERD_CHECK_CLASS_CYCLE¶
Checks that no class is a sub-class of itself, recursively.
This ensures that the graph is acyclic with respect to rdfs:subClassOf.
-
enumerator SERD_CHECK_CLASS_LABEL¶
Checks that every rdfs:Class has an rdfs:label.
-
enumerator SERD_CHECK_DATATYPE_CYCLE¶
Checks that no datatype is a refinement of itself, recursively.
This ensures that the graph is acyclic with respect to owl:onDatatype.
-
enumerator SERD_CHECK_DATATYPE_PROPERTY¶
Checks that datatype properties have literal (not instance) values.
-
enumerator SERD_CHECK_DATATYPE_TYPE¶
Checks that every datatype is defined as a rdfs:Datatype.
-
enumerator SERD_CHECK_DEPRECATED_CLASS¶
Checks that there are no instances of deprecated classes.
-
enumerator SERD_CHECK_DEPRECATED_PROPERTY¶
Checks that there are no uses of deprecated properties.
-
enumerator SERD_CHECK_FUNCTIONAL_PROPERTY¶
Checks that no instance has several values of a functional property.
-
enumerator SERD_CHECK_INSTANCE_LITERAL¶
Checks that there are no instances where a literal is expected.
-
enumerator SERD_CHECK_INSTANCE_TYPE¶
Checks that every instance with an explicit type matches that type.
This is a broad check that triggers other type-related checks, but mainly it will check that every instance of a class conforms to any restrictions on that class.
-
enumerator SERD_CHECK_INVERSE_FUNCTIONAL_PROPERTY¶
Checks that at most one instance has a given value of an inverse functional property.
-
enumerator SERD_CHECK_LITERAL_INSTANCE¶
Checks that there are no literals where an instance is expected.
-
enumerator SERD_CHECK_LITERAL_MAX_EXCLUSIVE¶
Checks that literal values are not greater than or equal to any applicable xsd:maxExclusive datatype restrictions.
-
enumerator SERD_CHECK_LITERAL_MAX_INCLUSIVE¶
Checks that literal values are not greater than any applicable xsd:maxInclusive datatype restrictions.
-
enumerator SERD_CHECK_LITERAL_MIN_EXCLUSIVE¶
Checks that literal values are not less than or equal to any applicable xsd:minExclusive datatype restrictions.
-
enumerator SERD_CHECK_LITERAL_MIN_INCLUSIVE¶
Checks that literal values are not less than any applicable xsd:minInclusive datatype restrictions.
-
enumerator SERD_CHECK_LITERAL_PATTERN¶
Checks that literals with xsd:pattern restrictions match the regular expression pattern for their datatype.
-
enumerator SERD_CHECK_LITERAL_RESTRICTION¶
Checks that literals with supported restrictions conform to those restrictions.
This is a high-level check that triggers the more specific individual literal restriction checks.
-
enumerator SERD_CHECK_LITERAL_VALUE¶
Checks that literals with supported XSD datatypes are valid.
The set of supported types is the same as when writing canonical forms.
-
enumerator SERD_CHECK_OBJECT_PROPERTY¶
Checks that object properties have instance (not literal) values.
-
enumerator SERD_CHECK_PLAIN_LITERAL_DATATYPE¶
Checks that there are no typed literals where a plain literal is expected.
A plain literal may have an optional language tag, but not a datatype.
-
enumerator SERD_CHECK_PREDICATE_TYPE¶
Checks that every predicate is defined as an rdf:Property.
-
enumerator SERD_CHECK_PROPERTY_CYCLE¶
Checks that no property is a sub-property of itself, recursively.
This ensures that the graph is acyclic with respect to rdfs:subPropertyOf.
-
enumerator SERD_CHECK_PROPERTY_DOMAIN¶
Checks that any instance with a property with an rdfs:domain is in that domain.
-
enumerator SERD_CHECK_PROPERTY_LABEL¶
Checks that every rdf:Property has an rdfs:label.
-
enumerator SERD_CHECK_PROPERTY_RANGE¶
Checks that the value for any property with an rdfs:range is in that range.
-
enumerator SERD_CHECK_SOME_VALUES_FROM¶
Checks that instances of classes with owl:someValuesFrom property restrictions have at least one matching property value.
-
enumerator SERD_CHECK_NOTHING¶
-
typedef struct SerdValidatorImpl SerdValidator¶
Model validator.
-
SerdValidator *serd_validator_new(SerdWorld *world)¶
Create a new validator.
- Returns
A newly-allocated validator with no checks enabled which must be freed with
serd_validator_free()
.
-
void serd_validator_free(SerdValidator *validator)¶
Free
validator
-
SerdStatus serd_validator_enable_check(SerdValidator *validator, SerdValidatorCheck check)¶
Enable a validator check.
-
SerdStatus serd_validator_disable_check(SerdValidator *validator, SerdValidatorCheck check)¶
Disable a validator check.
-
SerdStatus serd_validator_enable_checks(SerdValidator *validator, const char *regex)¶
Enable all validator checks with names that match the given pattern.
-
SerdStatus serd_validator_disable_checks(SerdValidator *validator, const char *regex)¶
Disable all validator checks with names that match the given pattern.
-
SerdStatus serd_validate_model(SerdValidator *const validator, const SerdModel *model, const SerdNode *graph)¶
Validate a model.
This performs validation based on the XSD, RDF, RDFS, and OWL vocabularies. All necessary data, including those vocabularies and any property/class definitions that use them, are assumed to be in the model.
Validation errors are reported to the world’s error sink.
- Parameters
validator – Validator configured to run the desired checks.
model – The model to validate.
graph – Optional graph to check. Is this is given, then top-level checks will be initiated only for statements in the given graph. The entire model is still searched while running a check so that, for example, schemas that define classes and properties can be stored in separate graphs.
- Returns
SerdStatus.SERD_SUCCESS
if no errors are found, orSerdStatus.SERD_BAD_DATA
if validation checks failed.