如何在RDF / OWL中声明“Pat知道Mike的电话号码”

时间:2012-10-28 23:17:25

标签: rdf semantic-web owl

我如何声明Pat知道Mike的电话号码是一个概念而不是RDF / OWL中的具体电话号码1112223333?

奖励积分可以说玛丽知道帕特知道迈克的电话号码....

3 个答案:

答案 0 :(得分:4)

使用合适的属性'know'可以使用rdf reification:

:Pat :knows [ 
  rdf:subject :Mike ;
  rdf:predicate :telephoneNumber ;
  rdf:object <tel:1112223333> 
]

很少有人喜欢具体化,但是对于这种事情,没关系。对于第二种情况享受双重具体化:

:Mary :knows [
  rdf:subject :Pat ;
  rdf:predicate :knows ;
  rdf:object [
    rdf:subject _:b1 ;
    rdf:predicate rdf:subject ;
    rdf:object :Mike ;
    rdf:subject _:b2 ;
    rdf:predicate rdf:predicate ;
    ... sanity barrier exceeded ...
  ]
]

如果你乐于走出一个单一的图表生活更简单。你可能只有几个文件:

FILE1:

:Mary :knowsContentsOf <FILE2>

FILE2:

:Mike :telephoneNumber <tel:1112223333>

或者甚至将两者都放在一个文件封套中并指向文件的片段。这基本上是命名图在SPARQL中提供的内容。

答案 1 :(得分:3)

以下内容(使用有效的OWL DL获取乐趣):

# assume prefixes defined
<>  a  owl:Ontology .
:Person  a  owl:Class .
:PhoneNumber  a  owl:Class .
:knowsThing  a  owl:ObjectProperty;
    rdfs:domain  :Person .
:belongsTo  a  owl:ObjectProperty;
    rdfs:range  :Person .
:Mike  a  :Person .
:Pat  a  :Person;
    :knowsThing  [
        a  :PhoneNumber;
        :belongsTo  :Mike
    ] .

关于玛丽的另一个陈述更加困难,因为我们不只是在谈论知道“事物”,而是谈论知识知识,这在OWL和RDF中非常不方便。但是,让我们坚持在OWL DL中实现它的挑战,具有以下本体:

<>  a  owl:Ontology .
:Person  a  owl:Class .
:PhoneNumber  a  owl:Class .
:knowsThing  a  owl:ObjectProperty;
    rdfs:domain  :Person .
:knownBy  a  owl:AnnotationProperty;
    rdfs:range  :Person .
:belongsTo  a  owl:ObjectProperty;
    rdfs:range  :Person .
:Mike  a  :Person .
:Pat  a  :Person;
    :knowsThing  _:mikesnumber .
_:mikesnumber  a  :PhoneNumber;
    :belongsTo  :Mike .
:Mary  a  :Person .
[]  a  owl:Annotation;
    owl:annotatedSource  :Pat;
    owl:annotatedProperty  :knowsThing;
    owl:annotatedTarget  _:mikenumber;
    :knownBy  :Mary .

问题在于它在推理方面不会给你太多。 user205512和cygri的答案是合理的选择,但它们在推理方面并没有给你带来太多帮助。

对于更多推理功能,你可以做一些疯狂的事情(仅适用于OWL 2 DL或OWL Full):

:subject  a  owl:ObjectProperty;
    rdfs:domain  :Statement .
:predicate  a  owl:ObjectProperty;
    rdfs:domain  :Statement .
:object  a  owl:ObjectProperty;
    rdfs:domain  :ObjectStatement .
:dataObject  a  owl:DatatypeProperty;
    rdfs:domain  :DataStatement .
:hasPhone  a  owl:DatatypeProperty .
:knowsFact  a  owl:ObjectProperty;
    rdfs:domain  :Person;
    rdfs:range  :Statement .
:ObjectStatement  a  owl:Class;
    rdfs:subClassOf  [
        owl:onProperty  :object;
        owl:cardinality 1
    ] .
:DataStatement  a  owl:Class;
    rdfs:subClassOf  [
        owl:onProperty  :dataObject;
        owl:cardinality 1
    ] .
:Statement  a  owl:Class;
    owl:unionOf  ( :ObjectStatement :DataStatement );
    rdfs:subClassOf  [
        owl:onProperty  :subject;
        owl:cardinality 1
    ], [
        owl:onProperty  :predicate;
        owl:cardinality 1
    ] .
:Person  a  owl:Class .
:Pat  :knowsFact  [
    :subject  :Mike;
    :predicate  :hasPhone
] .
:Mary  :knowsFact  [
    :subject  :Pat;
    :predicate  :knowsFact;
    :object  [
        :subject  :Mike;
        :predicate  :hasPhone
    ] .

答案 2 :(得分:2)

我用命名图解决这个问题。将三重“Mike的电话号码是1112223333”粘贴到一个命名图表中,然后将另一个三元组放入默认图表中,“Pat知道该命名图”。

OWL不支持命名图,但是SPARQL 1.0和RDF 1.1不支持,尽管还没有标准语法,因此您需要将各种图表从单独的文件单独加载到SPARQL存储中。 / p>