如何编写 RDF 模式?
我正在尝试使用 RDF 来描述自定义资源。我知道有 xmlns',例如 Dublin Core 和 foaf,它们提供了预定义的元素集。我该如何创建自己的?
当然,我可能找错了树,应该坚持使用 xml + xsd 吗?
I am trying to get my head around using RDF to describe custom resources. I understand there are xmlns' out there such as Dublin Core and foaf which provide predefined element sets. How do I go about creating my own?
I may be barking up the wrong tree of course and should stick to xml + xsd?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,任何人都可以在文件中编写 RDFS 或 OWL 公理的集合,然后开始在他们的应用程序中使用它。创建新词汇或本体的障碍很低,但有一些指导原则。
对于创建包含公理的文件的实际操作(即,如果您更熟悉该术语,则声明),我个人只是写在更紧凑的 Turtle 使用文本编辑器格式。我发现这与源代码控制系统配合得很好,并且适合我的工作方式。如果您想要更直观的界面,可以使用编辑器来帮助确保您所做的事情的正确性和一致性。常用的本体编辑器有 TopBraid Composer 和 Protege,但还有很多其他的。如果您确实在 Turtle 中工作,但想要发布为 RDF/XML 或其他格式,Jena 有一个命令用于在不同格式之间转换 RDF 文件的在线工具。
在发布词汇文件以便其他人可以使用它时,您应该安排概念的名称空间解析为描述它们的文档。因此,如果您创建一个词汇表,指定
http://example.org/vocab/pet#Iguana
、该 URL 或http://example.org/ 上的 HTTP GET vocab/pet
应该提供本体文档本身。更好的是,您将实现 HTTP 内容协商 (conneg),以便用户可以请求application/rdf+xml
、text/turtle
等格式的文档。如果您的词汇表设计用于内部网上使用,或仅用于演示/研究目的,那么发布不一定是您需要采取的步骤。链接数据或语义网的一个关键组成部分是尽可能重用定义,以便应用程序可以了解数据集如何相互链接。例如,如果您的词汇表有名称概念,请考虑重新使用 FOAF 中的命名谓词而不是自己发明。你提到了都柏林核心——该词汇在其他本体中被广泛重复使用。建模的这个方面可能需要一些时间才能正确,但这通常是一个迭代过程,这没关系。您可以在一些社区中获得帮助,并且越来越多的咨询公司提供专业帮助。
与任何软件活动一样,您从一开始就对目标用户及其需求越清楚,设计本体就越容易。
The short answer is that anyone can just write a collection of RDFS or OWL axioms in a file and start using it with their application. There's a low barrier to creating a new vocabulary or ontology, but there are some guiding principles.
For the actual act of creating the file containing the axioms (i.e. declarations if you're more comfortable with that terminology), I personally just write in the more-compact Turtle format using a text editor. I find this works well with source code control systems, and suits my way of working. There are editors out there if you want a more visual interface, with tools to help ensure correctness and consistency of what you are doing. Commonly used ontology editors are TopBraid Composer and Protege, but there are many others. If you do work in Turtle, but want to publish as RDF/XML or another format, Jena has a command-line tool for converting RDF files between different formats.
When it comes to publishing your vocabulary file, so that other people can use it, you should arrange that the namespace of your concepts resolves to the document describing them. So, if you create a vocabulary that specifies
http://example.org/vocab/pet#Iguana
, an HTTP GET on that URL, or onhttp://example.org/vocab/pet
should deliver the ontology document itself. Better yet, you will implement HTTP content negotiation (conneg), so that users can request the document inapplication/rdf+xml
,text/turtle
etc formats. If your vocabulary is designed for use in-house on an intranet, or for demo/research purposes only, then publication isn't necessarily a step you need to take.A key component of the linked-data or semantic web is that definitions are re-used where possible, so that applications can see how datasets interlink. For example, if your vocabulary has a concept of name, consider re-using the naming predicates from FOAF rather than invent your own. You mention Dublin Core - that vocabulary is widely re-used in other ontologies. This aspect of modelling can take some time to get right, but it will typically be an iterative process and that's OK. There are communities out there in which you can get help, and there are an increasing number of consultancies who offer professional assistance.
As with any software activity, the clearer you can be about your intended users and their requirements from the outset, the easier it will be to design your ontology.
RDFS + OWL 是用于定义 RDF 模式和本体的组合。
RDFS + OWL is a combination used to define RDF schemata and ontologies.