|
|
(5 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | [[Main Page]] >> [[Web Application Development]] >> [[Web Application Developpment - Workbook|Workbook]] >> Week 11 | + | [[Main Page]] >> [[6CC001|Advanced Web Technologies]] >> [[6CC001 - Workbook|Workbook]] >> Week 11 |
− | | |
− | Let's create an RDF file that specifies that:
| |
− | | |
− | * [http://en.wikipedia.org/wiki/Watchmen This page] is called “Watchmen” and is about comics
| |
− | * [http://en.wikipedia.org/wiki/Sin_city This page] is called “Sin City” and is about comics
| |
− | * [http://en.wikipedia.org/wiki/Maus This page] is called “Maus” and is about comics
| |
− | * [http://en.wikipedia.org/wiki/Nineteen_Eighty-Four This page] is called “1984” and is about books
| |
− | * [http://en.wikipedia.org/wiki/Never_Let_Me_Go This page] is called “Never le me go” and is about books
| |
− | * [http://en.wikipedia.org/wiki/Ender%27s_game This page] is called “Ender’s game” and is about books
| |
− | | |
− | Here is the code:
| |
− | | |
− | <pre>
| |
− | <rdf:RDF
| |
− | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
| |
− | xmlns:dc="http://purl.org/dc/elements/1.1/">
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Watchmen">
| |
− | <dc:title>Watchmen</dc:title>
| |
− | <dc:subject>Comics</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Sin_city">
| |
− | <dc:title>Sin City</dc:title>
| |
− | <dc:subject>Comics</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Maus">
| |
− | <dc:title>Maus</dc:title>
| |
− | <dc:subject>Comics</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Nineteen_Eighty-Four">
| |
− | <dc:title>1984</dc:title>
| |
− | <dc:subject>Books</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Never_Let_Me_Go">
| |
− | <dc:title>Never let me go</dc:title>
| |
− | <dc:subject>Books</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Ender%27s_game">
| |
− | <dc:title>Ender's game</dc:title>
| |
− | <dc:subject>Books</dc:subject>
| |
− | </rdf:Description>
| |
− |
| |
− | </rdf:RDF>
| |
− | </pre>
| |
− | | |
− | Using SPARQL, I can easily ask for all the pages that are on the subject of “comics”:
| |
− | | |
− | <pre>
| |
− | SELECT ?x
| |
− | FROM <http://mi-linux.wlv.ac.uk/~in9352/rdf/comics.rdf>
| |
− | WHERE { ?x <http://purl.org/dc/elements/1.1/subject> "Comics" }
| |
− | </pre>
| |
− | | |
− | Let’s test our query with this free SPARQL processor:
| |
− | * [http://sparql.org/sparql.html http://sparql.org/sparql.html]
| |
− | | |
− | These 3 pages are definitely on the topic of “comics” => better than Google’s keyword matching algorithm!
| |