使用XML扩展像FOAF这样的rdf词汇表是可能的,但是我如何使用定义中这样的词汇表中的类呢?基本上,我希望向foaf:person添加新的元素,并且我希望确保拥有这些元素意味着这个对象是foaf:Person,而不是其他任何东西。
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/NewXMLSchema" xmlns:foaf="http://xmlns.com/foaf/0.1/" elementFormDefault="qualified">
<xs:import foaf:namespace="http://xmlns.com/foaf/0.1/" foaf:schemaLocation="http://xmlns.com/foaf/spec/index.rdf"/>
<xs:complexType ref="foaf:Person">
<xs:sequence>
<xs:element name="owns">
<xs:complexType>
<xs:sequence>
<xs:element name="device">
<xs:complexType>
<xs:sequence>
<xs:element name="HereBeSomething"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="datapoints">
<xs:complexType>
<xs:sequence>
<xs:element name="point" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
Complex Type不应该是foaf:Person,但是这样做会导致错误:
“在这一行中找到多个注释:-S4s-att--必须出现:属性'name‘必须出现在元素'complexType’中。-S4s-att-att-不允许:属性'ref‘不能出现在元素’complexType‘中。”
如何在新架构的定义中使用来自其他RDF本体的类型?
发布于 2011-07-27 09:07:02
我不会去那里的。XML实际上不是处理RDF数据的好工具。很多人看到rdf的XML序列化,会想,“哦,这就像XML中添加了一些额外的rdf:this和rdf:那个属性。”但那是骗人的。
RDF是一组主谓-宾语三元组.将这些三元组写入文件有多种语法。RDF/XML就是其中之一,Turtle、和RDFa就是其中之一。
RDF/XML的问题在于,在RDF/XML文件中有许多不同的方式来编写同一组三元组。例如,以下两个片段完全等价:
<foaf:Person rdf:about="#cygri">
<foaf:nick>cygri</foaf:nick>
</foaf:Person>
<rdf:Description rdf:ID="cygri">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person">
<foaf:nick>cygri</foaf:nick>
</foaf:Person>总之:我建议不要使用XML工具来处理RDF数据。使用RDF工具。要扩展类似于FOAF的RDF架构,请使用。
https://stackoverflow.com/questions/6831972
复制相似问题