rdf - N3表示为RDF/XML

标签 rdf rdfs n3

我必须对N3进行采样,并且需要将其转换为相应的RDF/XML格式,有什么帮助吗?

 crop:AttributeValue a rdfs:Class . 
 crop:SomeValue a rdfs:Class; rdfs:subClassOf crops:AttributeValue .

 crop:SomeValue/7 a crops:SomeValue .

 crop:SomeValue a rdf:Property ; rdfs:range crops:SomeValue .

最佳答案

您需要指定更多信息,例如像这样

@prefix crop: <http://example.org/foo#> .
@prefix crops: <http://example.org/foo#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/TR/rdf-schema/> .

crop:AttributeValue a rdfs:Class . crop:SomeValue a rdfs:Class; rdfs:subClassOf crops:AttributeValue .

<http://example.org/foo#SomeValue/7> a crops:SomeValue .

crop:SomeValue a rdf:Property ; rdfs:range crops:SomeValue .

用正确的名称替换crop和crop的 namespace 。

这将是RDF/XML中的以下内容
<?xml version="1.0"?>
<rdf:RDF xmlns:rdfs="http://www.w3.org/TR/rdf-schema/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:crops="http://example.org/foo#">
    <rdfs:Class rdf:about="http://example.org/foo#SomeValue">
        <rdfs:subClassOf>
            <rdfs:Class rdf:about="http://example.org/foo#AttributeValue" />
        </rdfs:subClassOf>
        <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
        <rdfs:range rdf:resource="http://example.org/foo#SomeValue" />
    </rdfs:Class>
    <crops:SomeValue rdf:about="http://example.org/foo#SomeValue/7" />
</rdf:RDF>

这是一个在线转换工具:http://www.rdfabout.com/demo/validator/

关于rdf - N3表示为RDF/XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6612525/

相关文章:

java - 如何使用代码找出 sparql 查询的类型?

schema - 如何根据模式验证 JSON-LD?

rdf - 我如何在 OWL 中声明属性必须具有一组有序值?

python - 在python中将Notation3文件序列化为RDFXML格式时出错

java - freebase 的 RDF java 示例无法正常工作

c# - 我怎样才能像原始文件一样保存我的 n3 文件格式

java - 如何解析此文件并捕获所有 'Data Gather' 文本?

java - 一旦我编写了内置函数,我需要做什么才能让推理机意识到它?

java - 使用 D2RQ 映射数据库

rdf - 为什么一个类写成 rdfs :Class and a property is written as rdf:Property