Nat*_*Cox 1 rdf semantic-web owl ontology rdfs
OWL是否可能对语言属性具有最大基数限制,这将限制每种语言的基数。
例如,我只希望dct:title
每种语言最多一种。所以,
:demo dct:title "Demo"@en, "Demo"@nl.
Run Code Online (Sandbox Code Playgroud)
可以,但是
:bad_demo dct:title "Bad demo"@en, "Wrong demo"@en.
Run Code Online (Sandbox Code Playgroud)
会给一个错误?
您可以在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.
# ...
]
].
Run Code Online (Sandbox Code Playgroud)
使用此本体,以下内容将不一致:
<doc1> a <ThingWithTitle>;
dct:title "Title"@en, "Another title"@en-UK .
Run Code Online (Sandbox Code Playgroud)
您可以更具体一些,并允许多个英语/荷兰语标题,只要它们不在同一方言中即可。只需更换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>
]
)
]
]
)
]
]
]
] .
Run Code Online (Sandbox Code Playgroud)
读者可以自己验证它是否在OWL 2基于RDF的语义内正常工作。