Other answers explained that this could be done using XSD faces to limit the range of property strings to those that match the [AZ] pattern, but none showed the resulting RDF. I created a very simple ontology in Protégé and defined the hasLatinInitial data hasLatinInitial . Like the other answers described, the range was specified as string[pattern "[AZ]"] . Then I created a separate JohnDoe and added data property statements that
JohnDoe hasLatinInitial "J" . JohnDoe hasLatinInitial "D" .
and HermiT 1.3.7 did run and did not report inconsistencies. Then I added a statement
JohnDoe hasLatinInitial "3" .
and HermiT 1.3.7 reported inconsistencies:

Here the resulting ontology looks like in N3 and RDF / XML:
@prefix : <http://www.example.com/example
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:example="http://www.example.com/example#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <owl:Ontology rdf:about="http://www.example.com/example"/> <owl:DatatypeProperty rdf:about="http://www.example.com/example#hasLatinInitial"> <rdfs:range> <rdfs:Datatype> <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> <owl:withRestrictions rdf:parseType="Collection"> <rdf:Description> <xsd:pattern>[AZ]</xsd:pattern> </rdf:Description> </owl:withRestrictions> </rdfs:Datatype> </rdfs:range> </owl:DatatypeProperty> <owl:NamedIndividual rdf:about="http://www.example.com/example#JohnDoe"> <example:hasLatinInitial>3</example:hasLatinInitial> <example:hasLatinInitial>D</example:hasLatinInitial> <example:hasLatinInitial>J</example:hasLatinInitial> </owl:NamedIndividual> </rdf:RDF>
source share