标签: rdfs

如何使用SPARQL从triples中提取rdf:about或rdf:ID属性?

这在开始时似乎是一件小事,但到目前为止,我还没有设法使用SPARQL获取给定资源的唯一标识符.我的意思是,例如,rdf:Description rdf:about="http://..."然后一些属性识别此资源,我想要做的是首先找到这个非常资源,然后检索给定一些URI的所有三元组.

我通过在一个WHERE子句中编写语句来尝试天真的方法,例如:

?x rdf:about ?y and ?x rdfs:about ?y
Run Code Online (Sandbox Code Playgroud)

我希望我是准确的.

java rdf semantic-web rdfs triplestore

2
推荐指数
1
解决办法
2669
查看次数

如何在OWL中定义属性的域?

我想构建一个本体来处理感染或未感染疾病的人:

<?xml version="1.0"?>
</rdf:RDF>
    <owl:Class rdf:about="&person;Disease"/>

    <owl:Class rdf:about="&person;HealthyPerson">
        <rdfs:subClassOf rdf:resource="&person;Person"/>
        <owl:disjointWith rdf:resource="&person;SickPerson"/>
    </owl:Class>

    <owl:Class rdf:about="&person;Person"/>

    <owl:Class rdf:about="&person;SickPerson">
        <rdfs:subClassOf rdf:resource="&person;Person"/>
    </owl:Class>
</rdf:RDF>
Run Code Online (Sandbox Code Playgroud)

图形:

类层次结构为树

我怎样才能定义属性has_disease(人,病)以这样的方式该类型的个人Person相关的一些Diseasehas_disease将被推断有型SickPerson,也?

rdf owl ontology rdfs

2
推荐指数
1
解决办法
301
查看次数

Jena多个rdfs:标签

我是Jena和Owl的新手,我获得了本体论.我可以用Protege 4.2打开它而没有任何问题但是当我尝试用Jena打开它时我得到了: Exception in thread "main" org.apache.jena.riot.RiotException: {E201} Multiple children of property element.

我一直在我的Ontology中查看它可能是什么,我注意到一些元素在一种语言中有多个Label,例如:

<AnnotationAssertion>
    <AnnotationProperty abbreviatedIRI="rdfs:label"/>
    <AbbreviatedIRI>atc:A02BX02</AbbreviatedIRI>
    <Literal xml:lang="no" datatypeIRI="&rdf;PlainLiteral">Sukralfat</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
    <AnnotationProperty abbreviatedIRI="rdfs:label"/>
    <AbbreviatedIRI>atc:A02BX02</AbbreviatedIRI>
    <Literal xml:lang="no" datatypeIRI="&rdf;PlainLiteral">antepsin</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
    <AnnotationProperty abbreviatedIRI="rdfs:label"/>
    <AbbreviatedIRI>atc:A02BX02</AbbreviatedIRI>
    <Literal datatypeIRI="&xsd;string">sucralfate</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
    <AnnotationProperty abbreviatedIRI="rdfs:label"/>
    <AbbreviatedIRI>atc:A02BX02</AbbreviatedIRI>
    <Literal xml:lang="no" datatypeIRI="&rdf;PlainLiteral">sukralfat</Literal>
</AnnotationAssertion>
Run Code Online (Sandbox Code Playgroud)

这会导致问题吗?我使用的所有代码都与其他本体一起工作,所以我认为它真的来自这个本体.你知道什么可能导致这个例外吗?

编辑

所以我得到了一个最小化的案例,仍然得到同样的错误:

<?xml version="1.0"?>

<!DOCTYPE Ontology [
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
    <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>


<Ontology xmlns="http://www.w3.org/2002/07/owl#"
     xml:base="http://www.ebi.ac.uk/Rebholz-srv/atc/public/ontologies/atc.owl"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     ontologyIRI="http://www.ebi.ac.uk/Rebholz-srv/atc/public/ontologies/atc.owl">
    <Prefix …
Run Code Online (Sandbox Code Playgroud)

java owl ontology rdfs jena

2
推荐指数
1
解决办法
3016
查看次数

RDF Turtle语法问题

我有以下有效的Turtle语法:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix sc: <http://education.data.gov.uk/def/school/School#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos>.

<http://example.com/schools/#1000> a <http://education.data.gov.uk/def/school/School> . 
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/establishmentName>    "Atherstone Early Years Centre". 
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/establishmentNumber> "1000". 
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/Address>  [<http://education.data.gov.uk/def/school/address1> "RATCLIFFE ROAD";     <http://education.data.gov.uk/def/school/postcode> "CV9 1LF"]. 
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/establishmentType> "Nursery".
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/districtAdministrative> "North Warwickshire".
<http://example.com/schools/#1000> <http://education.data.gov.uk/def/school/uniqueReferenceNumber> "2016".
<http://example.com/schools/#1000> geo:lat "52.5786677".
<http://example.com/schools/#1000> geo:long "-1.5420408".
Run Code Online (Sandbox Code Playgroud)

我基本上定义了一个学校对象,id#1000之后我添加了属性.我想知道我是否可以<http://example.com/schools/#1000>在每个属性之前摆脱定义,并以某种方式用括号或其他东西包围属性.有任何想法吗?

syntax rdf rdfs turtle-rdf

2
推荐指数
1
解决办法
199
查看次数

为什么RDF被认为是无模式的?

人们将资源描述框架(RDF)视为无模式数据模型.但是,有一种称为RDF Schema(RDFS)的东西.那么,为什么RDF是无模式数据模型?

rdf rdfs rdfstore

2
推荐指数
1
解决办法
229
查看次数

sparql如何根据日期范围进行过滤

我有以下过滤器,可以将我的数据过滤到上周的项目.

#just consider the likes in the last one week.
  filter (?ratingDate >= "2017-03-01T00:00:00"^^xsd:dateTime )
Run Code Online (Sandbox Code Playgroud)

如你所见,我在手中设置了上周的日期时间(硬编码),有没有办法自动设置这个日期?

我正在寻找像现在这样的东西- 7天

rdf semantic-web owl rdfs sparql

2
推荐指数
1
解决办法
378
查看次数

文字是RDF资源吗?

像很多人一样,我使用rdf:Statements来实现三元组,以便我可以对语句进行陈述,例如

:S1 a rdf:Statement .
:S1 :citation :tabloid_celebrity1 .
:S1 rdf:subject :Earth . 
:S1 rdf:predicate :has_shape . 
:S1 rdf:object :flat_surface . 
Run Code Online (Sandbox Code Playgroud)

我最喜欢的网站中,https://www.infowebml.ws/rdf-owl/,说rdfs:rangerdf:objectrdfs:Resource.

文字是否被视为rdfs:Resources?如果不是,这是否意味着属性rdf:object不应该以文字为对象?即,这是非法的吗?

:S2 a rdf:Statement .
:S2 :citation <https://en.wikipedia.org/wiki/Age_of_the_Earth> .
:S2 rdf:subject :Earth . 
:S2 rdf:predicate :has_age_years . 
:S2 rdf:object "4.54E9"^^xsd:double . 
Run Code Online (Sandbox Code Playgroud)

rdf rdfs

2
推荐指数
1
解决办法
223
查看次数

RDF/XML 如何定义 RDFS 类、子类并将它们链接为类型

我们如何在 Jena 中定义类和子类并将它们添加为其他资源的类型?我使用 Java、Jena 和 RDF/XML 表示法。我想创建类似的东西:

<rdfs:Class rdf:about="http://www.help.me/NS/Classname"/>
<rdfs:Class rdf:about="http://www.help.me/NS/Subclassname">
    <rdfs:subClassOf rdf:resource="http://www.help.me/NS/Classname"/>
</rdfs:Class>
Run Code Online (Sandbox Code Playgroud)

之后:将资源链接到子类:

<rdf:Description rdf:about="http://www.help.me/NS/NewResource">
    <rdf:type rdf:resource="http://www.help.me/NS/Subclassname"/>
    ...
</rdf:Description>
Run Code Online (Sandbox Code Playgroud)

编辑:

到目前为止,我找到了如何定义一个类:

model.createResource("http://www.help.me/NS/", RDFS.Class);
Run Code Online (Sandbox Code Playgroud)

java rdf rdfs jena

1
推荐指数
1
解决办法
4459
查看次数

subClassOf 和 RDF 实例 rdfs:Class

在 RDFS 中,所有事物都是rdfs:Resource. 所有其他类都是 的子类rdfs:Resource。并且rdfs:Resource是 的一个实例rdfs:Class

我的问题是:有人可以帮助解释上面的这一段吗?我对这个子类和实例以及它们为什么有这种关系感到困惑。

rdf semantic-web ontology rdfs

1
推荐指数
1
解决办法
1107
查看次数

选择以递归方式链接到一个主题的所有内容

所以,我想选择以特定方式递归链接到主题的所有内容.我知道sparql AF​​AIK中没有递归,所以我希望还有其他方法可以解决这个问题.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ir: <http://itemrelation.com/ir#>
SELECT ?item
WHERE { ?item a ir:Item .
    { ir:MainItem ir:RelatedTo ?item }
    UNION { ?item ir:RelatedTo ir:MainItem } }
Run Code Online (Sandbox Code Playgroud)

这应该得到项目ir的所有项目:MainItem具有关系"ir:RelatedTo"to,以及与项目ir:MainItem具有关系"ir:RelatedTo"的所有项目.

但这不是我想要的,我想以与ir:MainItem相关的方式获取当前所选项目以及与当前所选项目相关的所有项目.不仅如此,我还希望与这些项目相关的项目也是如此......

所以,问题是,如何以所描述的方式获得与ir:MainItem"递归相关"的所有项目?

recursion rdf rdfs sparql

1
推荐指数
1
解决办法
57
查看次数

标签 统计

rdfs ×10

rdf ×9

java ×3

ontology ×3

owl ×3

semantic-web ×3

jena ×2

sparql ×2

rdfstore ×1

recursion ×1

syntax ×1

triplestore ×1

turtle-rdf ×1