Limit xsd: string [AZ] for rdfs: range

How to specify the range of the datatype property as xsd: strings whose literal forms match [AZ]? The limitations of OWL do not do the trick for me, at least at first glance. Is there a way to do this with regular expressions, and if so, where?

+6
source share
3 answers

I suppose you mean "single uppercase letter", which is string[pattern "[AZ]"] .

If you are using Protege, enter it in the Data Range Expression tab.

HermiT 1.3.7 can verify this and provide an explanation of inconsistent property values.

+4
source

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:

enter image description here

Here the resulting ontology looks like in N3 and RDF / XML:

 @prefix : <http://www.example.com/example#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix example: <http://www.example.com/example#> . <http://www.example.com/example> a owl:Ontology . example:hasLatinInitial a owl:DatatypeProperty ; rdfs:range [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ([ xsd:pattern "[AZ]" ]) ] . example:JohnDoe a owl:NamedIndividual ; example:hasLatinInitial "3" , "J" , "D" 
 <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> 

+1
source

The following expression in Manchester syntax should do the trick:

string[pattern "AZ"]

You can express this as a range of data in Protege. I'm not sure what reasoning uses the construct, but I have never used it before.

Additional information about him: http://www.w3.org/TR/owl2-manchester-syntax/#facet

0
source

Source: https://habr.com/ru/post/945753/


All Articles