Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Resource Description Framework
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Examples == === Example 1: Description of a person named Eric Miller === The following example is taken from the W3C website<ref name="rdf-primer">{{cite web|url= http://www.w3.org/TR/rdf-primer/|title= RDF Primer |publisher=[[W3C]]|access-date=2009-03-13}}</ref> describing a resource with statements "there is a Person identified by <nowiki>http://www.w3.org/People/EM/contact#me</nowiki>, whose name is Eric Miller, whose email address is e.miller123(at)example (changed for security purposes), and whose title is Dr." [[Image:Rdf graph for Eric Miller.png|thumb|An RDF Graph Describing Eric Miller<ref name="rdf-primer" />]] The resource "<nowiki>http://www.w3.org/People/EM/contact#me</nowiki>" is the subject. The objects are: * "Eric Miller" (with a predicate "whose name is"), * <nowiki>mailto:e.miller123</nowiki>(at)example (with a predicate "whose email address is"), and * "Dr." (with a predicate "whose title is"). The subject is a URI. The predicates also have URIs. For example, the URI for each predicate: * "whose name is" is <nowiki>http://www.w3.org/2000/10/swap/pim/contact#fullName</nowiki>, * "whose email address is" is <nowiki>http://www.w3.org/2000/10/swap/pim/contact#mailbox</nowiki>, * "whose title is" is <nowiki>http://www.w3.org/2000/10/swap/pim/contact#personalTitle</nowiki>. In addition, the subject has a type (with URI <nowiki>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</nowiki>), which is person (with URI <nowiki>http://www.w3.org/2000/10/swap/pim/contact#Person</nowiki>). Therefore, the following "subject, predicate, object" RDF triples can be expressed: * <nowiki>http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#fullName,</nowiki> "Eric Miller" * <nowiki>http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#mailbox, mailto:e.miller123(at)example</nowiki> * <nowiki>http://www.w3.org/People/EM/contact#me, http://www.w3.org/2000/10/swap/pim/contact#personalTitle,</nowiki> "Dr." * <nowiki>http://www.w3.org/People/EM/contact#me, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2000/10/swap/pim/contact#Person</nowiki> In standard N-Triples format, this RDF can be written as: <syntaxhighlight lang="turtle"> <http://www.w3.org/People/EM/contact#me> <http://www.w3.org/2000/10/swap/pim/contact#fullName> "Eric Miller" . <http://www.w3.org/People/EM/contact#me> <http://www.w3.org/2000/10/swap/pim/contact#mailbox> <mailto:e.miller123(at)example> . <http://www.w3.org/People/EM/contact#me> <http://www.w3.org/2000/10/swap/pim/contact#personalTitle> "Dr." . <http://www.w3.org/People/EM/contact#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/10/swap/pim/contact#Person> . </syntaxhighlight> Equivalently, it can be written in standard Turtle (syntax) format as: <syntaxhighlight lang="turtle"> @prefix eric: <http://www.w3.org/People/EM/contact#> . @prefix contact: <http://www.w3.org/2000/10/swap/pim/contact#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . eric:me contact:fullName "Eric Miller" . eric:me contact:mailbox <mailto:e.miller123(at)example> . eric:me contact:personalTitle "Dr." . eric:me rdf:type contact:Person . </syntaxhighlight> Or more concisely, using a common shorthand syntax of Turtle as: <syntaxhighlight lang="turtle"> @prefix eric: <http://www.w3.org/People/EM/contact#> . @prefix contact: <http://www.w3.org/2000/10/swap/pim/contact#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . eric:me contact:fullName "Eric Miller" ; contact:mailbox <mailto:e.miller123(at)example> ; contact:personalTitle "Dr." ; rdf:type contact:Person . </syntaxhighlight> Or, it can be written in RDF/XML format as: <syntaxhighlight lang="xml"> <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#" xmlns:eric="http://www.w3.org/People/EM/contact#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="http://www.w3.org/People/EM/contact#me"> <contact:fullName>Eric Miller</contact:fullName> </rdf:Description> <rdf:Description rdf:about="http://www.w3.org/People/EM/contact#me"> <contact:mailbox rdf:resource="mailto:e.miller123(at)example"/> </rdf:Description> <rdf:Description rdf:about="http://www.w3.org/People/EM/contact#me"> <contact:personalTitle>Dr.</contact:personalTitle> </rdf:Description> <rdf:Description rdf:about="http://www.w3.org/People/EM/contact#me"> <rdf:type rdf:resource="http://www.w3.org/2000/10/swap/pim/contact#Person"/> </rdf:Description> </rdf:RDF> </syntaxhighlight> === Example 2: The postal abbreviation for New York === Certain concepts in RDF are taken from [[logic]] and [[linguistics]], where subject-predicate and subject-predicate-object structures have meanings similar to, yet distinct from, the uses of those terms in RDF. This example demonstrates: In the [[English language]] statement '' 'New York has the postal abbreviation NY' '','' 'New York' '' would be the subject, '' 'has the postal abbreviation' '' the predicate and '' 'NY' '' the object. Encoded as an RDF triple, the subject and predicate would have to be resources named by URIs. The object could be a resource or literal element. For example, in the N-Triples form of RDF, the statement might look like: <syntaxhighlight lang="turtle"> <urn:x-states:New%20York> <http://purl.org/dc/terms/alternative> "NY" . </syntaxhighlight> In this example, "<nowiki>urn:x-states:New%20York</nowiki>" is the URI for a resource that denotes the US state [[New York (state)|New York]], "<nowiki>http://purl.org/dc/terms/alternative</nowiki>" is the URI for a predicate (whose human-readable definition can be found here<ref>[https://www.dublincore.org/specifications/dublin-core/dcmi-terms/terms/alternative/ DCMI Metadata Term alternative]. Dublincore.org. Retrieved on 2022-01-10.</ref>), and "NY" is a literal string. Note that the URIs chosen here are not standard, and do not need to be, as long as their meaning is known to whatever is reading them. === Example 3: A Wikipedia article about Tony Benn === In a like manner, given that <nowiki>"https://en.wikipedia.org/wiki/Tony_Benn"</nowiki> identifies a particular resource (regardless of whether that URI could be traversed as a hyperlink, or whether the resource is ''actually'' the [[Wikipedia]] article about [[Tony Benn]]), to say that the title of this resource is "Tony Benn" and its publisher is "Wikipedia" would be two assertions that could be expressed as valid RDF statements. In the N-Triples form of RDF, these statements might look like the following: <syntaxhighlight lang="turtle"> <https://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/title> "Tony Benn" . <https://en.wikipedia.org/wiki/Tony_Benn> <http://purl.org/dc/elements/1.1/publisher> "Wikipedia" . </syntaxhighlight> To an English-speaking person, the same information could be represented simply as: <blockquote>The title of this resource, which is published by Wikipedia, is 'Tony Benn'</blockquote> However, RDF puts the information in a formal way that a machine can understand. The purpose of RDF is to provide an [[Semantics encoding|encoding]] and interpretation mechanism so that [[Resource (computer science)|resources]] can be described in a way that particular [[software]] can understand it; in other words, so that software can access and use information that it otherwise could not use. Both versions of the statements above are wordy because one requirement for an RDF resource (as a subject or a predicate) is that it be unique. The subject resource must be unique in an attempt to pinpoint the exact resource being described. The predicate needs to be unique in order to reduce the chance that the idea of [[Title]] or [[Publisher]] will be ambiguous to software working with the description. If the software recognizes ''<nowiki>http://purl.org/dc/elements/1.1/title</nowiki>'' (a specific [[definition]] for the [[concept]] of a title established by the Dublin Core Metadata Initiative), it will also know that this title is different from a land title or an honorary title or just the letters t-i-t-l-e put together. The following example, written in Turtle, shows how such simple claims can be elaborated on, by combining multiple RDF vocabularies. Here, we note that the primary topic of the Wikipedia page is a "Person" whose name is "Tony Benn": <syntaxhighlight lang="turtle"> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . <https://en.wikipedia.org/wiki/Tony_Benn> dc:publisher "Wikipedia" ; dc:title "Tony Benn" ; foaf:primaryTopic [ a foaf:Person ; foaf:name "Tony Benn" ] . </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)