Danh mục

Creating Applications with Mozilla-Chapter 10. RDF, RDF Tools, and the Content Model-P1

Số trang: 15      Loại file: pdf      Dung lượng: 85.07 KB      Lượt xem: 11      Lượt tải: 0    
Hoai.2512

Hỗ trợ phí lưu trữ khi tải xuống: 5,000 VND Tải xuống file đầy đủ (15 trang) 0

Báo xấu

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Chapter 10. RDF, RDF Tools, and the Content Model-P1Chapter 9 introduced the Resource Description Framework (RDF) as the basis for building display data in the interface, where XUL templates take RDF-based data and transform it into regular widgets. But RDF is used in many other more subtle ways in Mozilla. In fact, it is the technology Mozilla uses for much of its own internal data handling and manipulation. RDF is, as its name suggests, a framework for integrating many types of data that go into the browser, including bookmarks, mail messages, user profiles, IRC channels, new Mozilla applications, and your...
Nội dung trích xuất từ tài liệu:
Creating Applications with Mozilla-Chapter 10. RDF, RDF Tools, and the Content Model-P1 Chapter 10. RDF, RDF Tools, and the Content Model-P1Chapter 9 introduced the Resource Description Framework (RDF) as thebasis for building display data in the interface, where XUL templates takeRDF-based data and transform it into regular widgets. But RDF is used inmany other more subtle ways in Mozilla. In fact, it is the technology Mozillauses for much of its own internal data handling and manipulation.RDF is, as its name suggests, a framework for integrating many types of datathat go into the browser, including bookmarks, mail messages, user profiles,IRC channels, new Mozilla applications, and your collection of sidebar tabs.All these items are sets of data that RDF represents and incorporates into thebrowser consistently. RDF is used prolifically in Mozilla, which is why thischapter is so dense.This chapter introduces RDF, provides some detail about how Mozilla usesRDF for its own purposes, and describes the RDF tools that are available onthe Mozilla platform. The chapter includes information on special JavaScriptlibraries that make RDF processing much easier, and on the use of RDF inmanifests to represent JAR file contents and cross-platform installationarchives to Mozilla.Once you understand the concepts in this chapter, you can make better useof data and metadata in your own application development.10.1. RDF BasicsRDF has two parts: the RDF Data Model and the RDF Syntax (or Grammar).The RDF Data Model is a graph with nodes and arcs, much like other datagraphs. More specifically, its a labeled-directed graph. All nodesand arcs have some type of label (i.e., an identifier) on them, and arcs pointonly in one direction.The RDF Syntax determines how the RDF Data Model is represented,typically as a special kind of XML. Most XML specifications define data ina tree-like model, such as XUL and XBL. But the RDF Data Model cannotbe represented in a true tree-like structure, so the RDF/XML syntax includesproperties that allow you to represent the same data in more than one way:elements can appear in different orders but mean the same thing, the samedata can be represented as a child element or as a parent attribute, and datahave indirect meanings. The meaning is not inherent in the structure of theRDF/XML itself; only the relationships are inherent. Thus, an RDFprocessor must make sense of the represented RDF data. Fortunately, anexcellent RDF processor is integrated into Mozilla.10.1.1. RDF Data ModelThree different types of RDF objects are the basis for all other RDFconcepts: resources, properties, and statements. Resources are any type ofdata described by RDF. Just as an English sentence is comprised of subjectsand objects, the resources described in RDF are typically subjects andobjects of RDF statements. Consider this example:Eric wrote a book.Eric is the subject of this statement, and would probably be an RDF resourcein an RDF statement. A book, the object, might also be a resource becauseit represents something about which we might want to say more in RDF --for example, the book is a computer book or the book sells for twentydollars. A property is a characteristic of a resource and might have arelationship to other resources. In the example, the book was written by Eric.In the context of RDF, wrote is a property of the Eric resource. An RDFstatement is a resource, a property, and another resource grouped together.Our example, made into an RDF statement, might look like this:(Eric) wrote (a book)Joining RDF statements makes an entire RDF graph. We are describing the RDF data model here, not the RDF syntax. The RDF syntax uses XML to describe RDF statements and the relationship of resources.As mentioned in the introduction, the RDF content model is a labeled-directed graph, which means that all relationships expressed in thegraph are unidirectional, as displayed in Figure 10-1.Figure 10-1. Simple labeled-directed graphA resource can contain either a URI or a literal. The root resource mighthave a URI, for example, from which all other resources in the graphdescend. The RDF processor continues from the root resource along itsproperties to other resources in the graph until it runs out of properties totraverse. RDF processing terminates at a literal, which is just what it soundslike: something that stands only for itself, generally represented by a string(e.g., book, if there were no more information about the book in thegraph). A literal resource contains only non-RDF data. A literal is a terminalpoint in the RDF graph.For a resource to be labeled, it must be addressed through a universalresource identifier (URI). This address must be a unique string thatdesignates what the resource is. In practice, most resources dont haveidentifiers because they are not nodes on the RDF gr ...

Tài liệu được xem nhiều: