Semantic Web for the Working Ontologist. Dean Allemang
Чтение книги онлайн.
Читать онлайн книгу Semantic Web for the Working Ontologist - Dean Allemang страница 26
RDF provides a facility for ordering elements in a list format. An ordered list can be expressed quite easily in Turtle as follows:
This translates into the following triples, where _:a
, _:b
, and _:c
are bnodes, and the order is indicated using two reserved properties in RDF called rdf:first
and rdf:rest
. The list is terminated with a reference to the resource rdf:nil
:
This rendition preserves the ordering of the objects but at a cost of considerable complexity of representation. Fortunately, the Turtle representation is quite compact, so it is not usually necessary to remember the details of the RDF triples behind it.
N-Quads
So far, we have talked about how to serialize triples. But what if we want to serialize triples in the context of one or more named graphs? The W3C provides simple extensions of the serializations for triples for use with named graphs. The simplest is called N-Quads.
Like N-Triples, N-Quads uses no CURIEs and no prefixes. A triple is written in the form of a quad, that is, with Subject, Predicate, Object and Graph, in that order. So, to extend our example from N-Triples, if we were to say that Product1 is a Product in graph http://www.WorkingOntologist.org/Examples/Chapter3/Manufacture, we would simply write
This is a very long line indeed (even longer than it was in N-Triples), so it doesn’t show up well in a book, but it is simple to write an parse—no shortcuts, no prefixes, just subject, predicate, object, graph, period.
TriG
TriG is an extension of the Turtle format from Section 3.8. It includes all of the abbreviations for namespaces and elisions with semicolons and commas as Turtle does. The main difference is that it is possible to specify a URI for a graph for all triples in the file. This is done simply by putting all the triples in a graph between braces ({ and }), and then prefix the name of the graph.
If we take the example from Section 3.8 about manufacturing products, and put them into a graph with name <http://www.WorkingOntologist.org/Examples/Chapter3/Manufacture>
, this can be expressed in TriG as follows:
In this way, we can express several graphs in a single file.
3.10 Summary
RDF is a simple standard; its job is to model distributed data on the Web. It accomplishes this job, and nothing more. If you want to model data in a distributed way, you can either use RDF or you will re-invent it; there isn’t very much to it. The basic idea of RDF is that, in a distributed setting, you need a global identifier for anything you refer to. If you want to connect that to some other thing, you will need a name for that. And if you want to connect them, you’ll need a name for the connection. All of these names have to be global.
The hypertext Web has already given us the global identifiers; we’ll see the details of how the Web infrastructure processes these identifiers, but that isn’t part of the Semantic Web, that’s part of the Web we all use every day. RDF doesn’t solve the distributed identity problem; the Web solved that, and RDF re-uses that solution.
Given this, the very minimum required for distributed represenation of data on the Web is a way to connect one Web identifier (i.e., a URI) to another, with a link that is also named with a URI. This is the basis of the RDF triple. Everything else is just plumbing. If you are distributing data, you’ll want a way to store it (those are the serializations). You’ll want a way to convert data from non-distributed forms (like tables) into distributed form. RDF simply provides the infrastructure to deal with the simplest way of representing distributed information.
As a data model, RDF provides a clear specification of what has to happen to merge information from multiple sources. It does not provide algorithms or technology to implement those processes. These technologies are the topic of subsequent chapters.
Fundamental concepts
The following fundamental concepts were introduced in this chapter.
• RDF (Resource Description Framework)—This distributes data on the Web.
• Triple—The fundamental data structure of RDF. A triple is made up of a subject, predicate, and object.
• Graph—A nodes-and-links structural view of RDF data.
• Merging—The process of treating two graphs as if they were one.
• URI (Uniform Resource Indicator)—A generalization of the URL (Uniform Resource Locator), which is the global name on the Web.
• namespace—A set of names that belongs to a single authority. Namespaces allow different agents to use the same word in different ways.
• CURIE—An abbreviated version of a URI, it is made up of a namespace identifier and a name, separated by a colon.
• rdf:type—The relationship between an instance and its type.
• rdf:Property—The type of any property in RDF.
• Reification—The practice of making a statement about another statement. It is done in RDF using
• rdf:subject, rdf:predicate, and Nonerdf:object.
• N-Triples, Turtle, RDF/XML—The serialization syntaxes for RDF.
• Blank nodes—RDF nodes that have no URI and thus cannot be referenced globally. They are used to stand in for anonymous entities.
1. We are primarily discussing files here, but a URI can refer to other resources. The Wikipedia article on URIs includes more than 50 different resource types that can be referenced by URIs—see http://en.wikipedia.org/wiki/URI_scheme
.
Конец ознакомительного фрагмента.
Текст предоставлен ООО «ЛитРес».
Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.