在OWL中是否有可能对语言属性具有最大基数限制,这将限制每种语言的基数。
例如,我每个语言最多只需要一个dct:title
。所以,
:demo dct:title "Demo"@en, "Demo"@nl.
没关系,但是
:bad_demo dct:title "Bad demo"@en, "Wrong demo"@en.
会出错吗?
您可以在OWL 2 DL中部分执行此操作。但是,您必须为您使用的每种语言添加基数约束。在OWL 2 DL中,您不能拥有适用于所有可能语言的通用公理。在Turtle语法中:
@base <http://example.com/>.
@prefix dct: <http://purl.org/dc/terms/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
<> a owl:Ontology;
rdfs:comment "An ontology with cardinality restrictions on some languages."@en .
<ThingWithTitle> a owl:Class;
rdfs:subClassOf [
a owl:Restriction;
owl:onProperty dct:title;
owl:maxQualifiedCardinality 1;
owl:onDataRange [
a rdfs:Datatype;
owl:onDatatype rdf:plainLiteral;
owl:withRestrictions ([rdf:langRange "en"])
]
], [
a owl:Restriction;
owl:onProperty dct:title;
owl:maxQualifiedCardinality 1;
owl:onDataRange [
a rdfs:Datatype;
owl:onDatatype rdf:plainLiteral;
owl:withRestrictions ([rdf:langRange "nl"])
]
], [
# ...
# same for de, es, fr, it, zh, etc.
# ...
]
].
使用此本体,以下内容将不一致:
<doc1> a <ThingWithTitle>;
dct:title "Title"@en, "Another title"@en-UK .
你可以更具体,并允许多个英语/荷兰语标题,只要它们不在同一个方言中。只需用rdf:langRange "en"
等替换rdf:langRange "en-UK"
。
在OWL 2 Full中,您可以一般地表达这一点(即,对于所有语言),但它非常复杂,并且地球上没有理由可以处理这种类型的推理,所以最好不要尝试,除非您喜欢学术挑战为了智力手淫。
编辑:
在一些激烈的精神手淫后,我想出了以下内容:
[
owl:onDatatype xsd:string;
owl:withRestrictions (
[
xsd:pattern "...regular_expression_for_an_extended_language_range_from_rfc_4647..."
]
)
] rdfs:subClassOf [
owl:onProperty [owl:inverseOf rdf:langRange];
owl:someValuesFrom [
owl:onProperty [owl:inverseOf rdf:first];
owl:someValuesFrom [
owl:onProperty [owl:inverseOf owl:withRestrictions];
owl:someValuesFrom [
owl:intersectionOf (
[
owl:onProperty owl:onDatatype;
owl:hasValue rdf:plainLiteral
], [
owl:onProperty [owl:inverseOf owl:onDataRange];
owl:someValuesFrom [
owl:intersectionOf (
[
owl:onProperty owl:maxQualifiedCardinality;
owl:hasValue 1
], [
owl:onProperty owl:onProperty;
owl:hasValue dct:title
], [
owl:onProperty [owl:inverseOf rdfs:subClassOf];
owl:hasValue <ThingWithTitle>
]
)
]
]
)
]
]
]
] .
验证它在OWL 2 RDF-based semantics内工作是留给读者的练习。