gpt4 book ai didi

rdf - 猫头鹰 rdfs :langString maxCardinality per language

转载 作者:行者123 更新时间:2023-12-02 14:51:44 28 4
gpt4 key购买 nike

在 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 内工作留给读者作为练习。

关于rdf - 猫头鹰 rdfs :langString maxCardinality per language,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55218946/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com