以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 RSS/FOAF/Dublin Core/CIM/PRISM/Gene Ontology 』 (http://bbs.xml.org.cn/list.asp?boardid=3) ---- RDF/XML 语法太过复杂?RDFa来啦!--- 《Introducing RDFa》 (http://bbs.xml.org.cn/dispbbs.asp?boardid=3&rootid=&id=43289) |
-- 作者:admin -- 发布时间:2/15/2007 11:23:00 PM -- RDF/XML 语法太过复杂?RDFa来啦!--- 《Introducing RDFa》 Introducing RDFa By Bob DuCharme February 14, 2007 For a long time now, RDF has shown great promise as a flexible format for storing, aggregating, and using metadata. Maybe for too long—its most well-known syntax, [URL=http://www.w3.org/TR/rdf-syntax-grammar/]RDF/XML[/URL], is messy enough to have scared many people away from RDF. The W3C is developing a new, simpler syntax called [URL=http://www.w3.org/2006/07/SWD/RDFa/syntax]RDFa[/URL] (originally called "RDF/a") that is easy enough to create and to use in applications that it may win back a lot of the people who were first scared off by the verbosity, striping, container complications, and other complexity issues that made RDF/XML look so ugly. RDF/XML doesn't have to be ugly, but even simple RDF/XML doesn't fit well into XHTML, because browsers and other applications designed around HTML choke on it. So, while the general plan for RDFa is to make it something that can be embedded into any XML dialect, the main effort has gone into making it easy to embed it into XHTML. This gives it an important potential role in the grand plan for the Semantic Web, in which web page data is readable not only by human eyes but by automated processes that can aggregate data and associated metadata and then perform tasks that are much more sophisticated than those that typical screen scraping applications can do now. In fact, the relationship between RDFa metadata and existing content in web pages has been an important driver in most use cases driving RDFa's progress. Plenty of software is already available to pull RDFa triples from XHTML documents and use them, which means that even though the specification isn't quite done, there's plenty to play with. The "a" in "RDFa" RDFa uses the existing XHTML 1 attributes href, content, rel, rev, and datatype, and it uses the new about, role and property attributes from XHTML 2's [URL=http://www.w3.org/TR/xhtml2/mod-metaAttributes.html]Metainformation Attributes[/URL] module. While the following chart of their use covers only a subset of ways to store RDFa metadata in an XHTML file, it's enough to get you pretty far. The [URL=http://www.w3.org/TR/xhtml-rdfa-primer/]RDFa Primer[/URL] and [URL=http://www.w3.org/2006/07/SWD/RDFa/syntax]RDF/A Syntax[/URL] W3C documents (and Part 2 of this article) describe more sophisticated ways to add RDFa metadata to your XHTML documents. There are two basic cases: triples that have a literal string as their object and triples that have a URI as their object. (When possible, it's better to have a URI as an object, because it lets the same value serve as the object of some triples and the subject of others. This makes it easier to connect triples and find new information through inferencing.) subject predicate object The RDFa syntax document tells us that "it should be possible to represent a [triple] using only one XML element." Let's look at three examples: <span about="http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html" <span about="http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html" <span about="http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html" The resource at http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html has a Dublin Core title value of "Generating a Single Globally Unique ID." The resource at http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html has a Dublin Core title value of "Generating a Single Globally Unique ID." The resource at http://www.snee.com/bobdc.blog/2006/12/generating_a_single_globally_u.html has a Dublin Core subject value of http://www.snee.com/bobdc.blog/neat_tricks/. If the first two triples say the same thing, why would you prefer one over the other? Assuming that your document has its title in the document's content before you begin adding RDFa markup, adding the second span element above means adding a little less text to your document; you just wrap the existing title in the span start- and end-tags shown, a technique that fits in well with the Semantic Web vision of turning existing web content into machine-readable content. If your title was already part of your document, the content attribute value of the first triple would add redundant information to your document, and if your document's title changes, you would need to change it in two places. On the other hand, when adding information that is not already part of the content of your document (for example, workflow information or attribution rights about components of the document) the first span element above provides a good model. The third span element above uses slightly different attributes to specify a triple that has a URI as an object value. RDFa Elements The a linking element is also popular for storing RDFa metadata, because it always expresses a relationship between one resource (the document where it's stored) and another (the resource it links to). The a element's rel attribute—which has actually been around [URL=http://www.w3.org/MarkUp/draft-ietf-iiir-html-01.txt]as long as HTML itself[/URL], despite its lack of use before Google's [URL=http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html]nofollow[/URL] trick came along—adds information about the relationship, and this information serves as the predicate of a triple stored in an a element. More Triples, Fewer Subjects Building on existing XHTML syntax, RDFa lets you build multiple triples from the same subject without cluttering up your document too much. An RDFa processor that finds no about attribute assumes that the about attribute on the nearest ancestor element is the subject. (As we'll see in Part 2 of this article, the presence of an id attribute can provide an alternative to this behavior.) For example, the following stores three metadata statements about the resource at http://www.snee.com/img/myfile.jpg, because although the three span elements have no about attribute, their parent img does: <img src="http://www.snee.com/img/myfile.jpg" This is handy, because plenty of a document's metadata is typically about the document itself. For example, your document's main title could have this span element to indicate that its contents is the Dublin Core title of the work (assuming that no ancestor of the sample h1 element has an about attribute): <h1><span property="dc:title">My Story</span></h1> <html> Inline metadata about document components Metadata about the containing document Out-of-line metadata <p>This photo was taken by <span class="author" about="photo1.jpg" property="dc:creator">Mark Birbeck</span>.</p> <rdf:Description rdf:about="file://C|/dat/xml/rdf/rdfa/photo1.jpg"> In that example, the PCDATA string "Mark Birbeck" provided the object of the triple. Sometimes you might want to provide an alternative version of the displayed data, such as a normalized version of a date. In this case, a value in a content attribute will override it: <p>Last revision of document: <span about="http://www.snee.com/docs/mydoc1.html" <rdf:Description rdf:about="http://www.snee.com/docs/mydoc1.html"> Metadata About the Containing Document <html xmlns:fm="http://www.foomagazine.com/ns/prod/"> <rdf:Description rdf:about=""> <html xmlns:fm="http://www.foomagazine.com/ns/prod/"> <rdf:Description rdf:about="file://C|/dat/xml/rdf/rdfa/test5.html#recipe13941"> Getting Those Triples The fact that reading RDFa is so easy to implement—you only need a program that can scan a document for certain combinations of a few elements and attributes—means that if no existing RDFa readers can do what you want, you can implement it yourself in any language that provides a reasonable XML parser. Getting More Out of RDFa |
-- 作者:admin -- 发布时间:2/15/2007 11:26:00 PM -- RDFa草案参见:http://www.w3.org/2006/07/SWD/RDFa/syntax/ 为方便大家阅读,下面摘抄片断: RDFa Syntax
1 Motivation RDF/XML [RDF-SYNTAX] provides sufficient flexibility to represent all of the abstract concepts in RDF [RDF-CONCEPTS]. However, it presents two challenges; first it is difficult or impossible to validate documents that contain RDF/XML using XML Schemas or DTD's, which makes it difficult to import RDF/XML into other markup languages. Whilst newer schema languages such as RELAX NG [RELAXNG] do provide a way to validate documents that contain arbitrary RDF/XML, it will be a while before they gain wide support. Second, even if one could add RDF/XML directly into an XML dialect like XHTML, there would be significant data duplication between the actual data and the RDF/XML metadata. It would be far better to add RDF to a document without repeating the document's existing data. For example, an XHTML document that explicitly renders its author's name "Mark Birbeck" should not need to repeat this name for RDF expression of the same concept: the existing markup should be augmentable to RDF with minimal data repetition. In the past, some attributes were 'hard-wired' directly into the markup language to represent specific concepts. For example, in XHTML 1.1 and HTML there is a cite attribute. The attribute allows an author to add information to a document to indicate the origin of a quote. The following example comes from [HTML], although it has been reformatted as XHTML [XHTML]: <blockquote cite="http://www.example.com/tolkien/twotowers.html"> The RDF/XML solution is to take the citation out as a specific statement about the quote. Our source document may now look like this: <blockquote id="q1"> <rdf:Description about="#q1"> <blockquote> <blockquote> <svg:text> This proposal therefore outlines a new XML syntax for RDF that relies only on XML attributes, and so can be easily imported into other markup languages allowing them to carry arbitrary RDF.
|
-- 作者:iamwym -- 发布时间:2/16/2007 6:43:00 PM -- 好像大家都过年去啦 |
-- 作者:smileidiot -- 发布时间:2/17/2007 9:37:00 AM -- 呵呵,我来踩点啦。。。 不过,RDF等都w3c规范了,我们应该如何看待非主流的呢? 又说OWL吧,大家或许都不怎么喜欢这咚咚,可是又都不得不提供对此支持啊。。。 |
-- 作者:Spark -- 发布时间:2/17/2007 11:10:00 PM -- RDFa至少会得到那些搞Web2.0的人的支持把~ |
-- 作者:雪褥织影 -- 发布时间:2/20/2007 12:16:00 PM -- 乱枪打鸟 |
-- 作者:Ambrosia -- 发布时间:2/22/2007 5:54:00 PM -- 捧场,捧场。好多熟人阿,给大家拜晚年了。我承认作应用的人对change from time to time 的本体语言有一点郁闷。。。 |
-- 作者:chris -- 发布时间:2/24/2007 1:05:00 PM -- 不是吧 很久没看本体了 怎么又换了一种语言 郁闷阿 |
-- 作者:superc_7 -- 发布时间:2/26/2007 10:54:00 PM -- RDFa就是类似RDF/XML的一种语法格式吧,本质上对RDF没有影响的 我觉得直接用三元组挺好的,语法上的序列化应该交给机器去自动完成 |
-- 作者:fairchilddb -- 发布时间:8/2/2008 6:33:00 PM -- 好东西 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
125.000ms |