Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
pl:dydaktyka:semweb:2016:labs:rdfmodel2 [2017/10/14 23:21]
kkutt usunięto
— (aktualna)
Linia 1: Linia 1:
-====== Modeling and using knowledge in RDF ====== 
  
-^  Last verification:​ | 20160924 | 
-^  Tools required for this lab: | -- | 
- 
-===== Before the lab ===== 
-Reading: 
-  * [[http://​www.w3.org/​TR/​rdf-schema/​|RDF Schema 1.1]] 
-  * [[#​if_you_want_to_know_more|If you want to know more...]] 
- 
-===== Lab instructions ===== 
- 
-<WRAP center round important 100%> 
-During this lab we will use [[http://​any23.org/​|Anything to Triples]] website. If it is down, there is also a possibility to download any23 service and run it on your own computer: 
-  * download **Apache Any23 Service (Standalone server embedded) 1.1** file from https://​any23.apache.org/​download.html (mirror: {{http://​home.agh.edu.pl/​~kkutt/​semweb/​apache-any23-service-1.1-server-embedded.tar.gz|apache-any23-service-1.1-server-embedded.tar.gz}}) and unpack the zip somewhere 
-  * execute command to start server with any23 service: <​code>​[PATH-to-unpacked-archieve]/​apache-any23-service-1.1-server-embedded/​bin/​any23server </​code>​ 
-    * Note: use the any23server.bat file if you are using Windows OS 
-    * Change ''<​nowiki>"​$REPO"</​nowiki>''​ into ''​%REPO%''​ twice (line #79 in any23server.bat file) if ''​Error:​ Unable to access jarfile $REPO/​jetty-runner-8.1.4.v20120524.jar.''​ message appears 
-  * after few seconds any23 service will appear on [[http://​localhost:​8080/​apache-any23-service/​]] address :) 
-</​WRAP>​ 
- 
-During this lab, you will create an RDF description (using Turtle syntax) of your multimedia library. 
-It may contain CDs, DVDs, books etc. 
-The documents created during this lab will be used in the subsequent labs. 
-==== - Modeling knowledge with RDF [15 minutes] ==== 
- 
-  - Create a text document, specify your own base namespace and save file as ''​mylibrary.ttl''​. <code | mylibrary.ttl>​ 
-@base   <​http://​kkutt/​mylibrary/>​ . 
-@prefix rdf: <​http://​www.w3.org/​1999/​02/​22-rdf-syntax-ns#>​ . 
- 
-# RDF Body...</​code>​ 
-    * Note the ''<​nowiki>​http://​www.w3.org/​1999/​02/​22-rdf-syntax-ns#</​nowiki>''​ namespace used in the document. 
-    * Comments in Turtle begins with ''#''​ symbol. 
-  - __Add statements about **10 items** from your library__: Add RDF statements about items in your multimedia library. Define some //​properties//​ of the items and fill in their //values// e.g.: <​code>​ 
-<​book-semweb>​ <​author>​ "Dean Allemang",​ 
-                "​James Hendler";​ 
- <​title>​ "​Semantic Web for the Working Ontologist";​ 
- <​publisher>​ <​Elsevier>;​ 
- <​lang>​ "​en"​. ​ 
-<​cd-rhcp_stadiumarcadium>​ <​artist>​ "Red Hot Chilli Peppers";​ 
- <​title>​ "​Stadium Arcadium";​ 
- <​lang>​ "​en"​. 
-</​code>​ 
-    * In RDF we are describing something (a subject) and giving it a unique ID, e.g.: ''<​nowiki><​http://​kkutt/​mylibrary/​book-semweb></​nowiki>''​. To make notation more compact, we can use [[http://​www.w3.org/​TR/​turtle/#​prefixed-name|prefixes]] and/or [[http://​www.w3.org/​TR/​turtle/#​relative-iri|base namespace]]. 
-    * 8-) To separate statements we can use dot (.), semicolon (;) and comma (,). What is the difference between them? 
- 
-==== - RDF: Containers and Collections [10 minutes] ==== 
-In RDF there are two ways to describe set or sequences of objects: //​[[http://​www.w3.org/​TR/​rdf11-mt/#​rdf-containers|Containters]]//​ and //​[[http://​www.w3.org/​TR/​rdf11-mt/#​rdf-collections|Collections]]//​. 
- 
-The container and collection are resources that contain things. The contained things are members. 
-RDF defines three types of containers: 
-    * ''​rdf:​Bag'',​ 
-    * ''​rdf:​Seq'',​ 
-    * ''​rdf:​Alt'',​ 
-and one type of collection: 
-    * ''​rdf:​List''​. 
-While "a //​container//​ only says that certain identified resources are members; it does not say that other members do not exist."​ with a //​Collection//​ we can describe groups containing __only__ the specified members. 
- 
-[[http://​www.w3.org/​TR/​rdf11-mt/#​rdf-containers|Read about them]] and then: 
-  - 8-) Describe shortly what is the difference between different types of containers. 
-  - Create a container called ''​MyFavouriteBooks''​ and fill it with the URIs of the books you like the most. 
-  - In your RDF file describe a book/CD/DVD which has multiple authors or actors playing in it. Use the //RDF Collection//​. For hint and examples see the [[http://​www.w3.org/​TR/​turtle/#​collections|recommendation]]. 
- 
-==== - RDF: Datatypes [10 minutes] ==== 
-Add the references to [[http://​www.w3.org/​TR/​xmlschema-2/​|XML Schema datatypes]] to chosen information in your RDF file, e.g.: 
-<​code>​ 
-# ... 
-@prefix xsd: <​http://​www.w3.org/​2001/​XMLSchema#>​ . 
-# ... 
- 
-# ... 
-<​cd-rhcp_stadiumarcadium>​ <​artist>​ "Red Hot Chilli Peppers"​^^xsd:​string;​ 
- <​title>​ "​Stadium Arcadium"​^^xsd:​string;​ 
- <​lang>​ "​en"​. 
-# ... 
-</​code>​ 
-Use at least 3 different datatypes! 
- 
-==== - RDF Visualization [10 minutes] ==== 
- 
-We are in the middle, so let's visualize our RDF files. 
- 
-  - Using <wrap caution>​[[http://​any23.org/​|Anything to Triples]]</​wrap>​ service convert your file to RDF/XML (''​rdfxml''​) format. Do not analyze resulting code. Simply copy it :) 
-  - Go to the [[http://​www.w3.org/​RDF/​Validator/​|RDF Validator]] page and simply paste generated code into ''​Check by Direct Input''​ field. Select ''​Graph only''​ from dropdown list and click ''​Parse RDF''​ 
-  - Analyze the results: 
-    - 8-) How containers are represented in the graph? 
-    - 8-) How collections are represented in the graph? 
- 
-==== - Semantic vocabularies:​ Dublin Core [10 minutes] ==== 
- 
-Semantic vocabularies are sets of predefined properties for describing some domains. Examples include: 
-  * [[http://​semanticweb.org/​wiki/​Dublin_Core|Dublin Core]] 
-  * [[http://​semanticweb.org/​wiki/​FOAF|FOAF]] 
-  * [[http://​semanticweb.org/​wiki/​SIOC|SIOC]] 
-  * etc. 
- 
-  - Have a look at [[http://​dublincore.org/​documents/​dc-rdf/​|Expressing Dublin Core metadata using the Resource Description Framework]]. 
-  - Modify your RDF file to use the properties from Dublin Core vocabulary, e.g.: 
-<​code>​ 
-# ... 
-@prefix dc: <​http://​purl.org/​dc/​elements/​1.1/>​. 
-@prefix dcterms: <​http://​purl.org/​dc/​terms/>​ . 
-# ... 
- 
-# ... 
-<​book-semweb>​ <​author>​ "Dean Allemang",​ 
-                "​James Hendler";​ 
- dc:title "​Semantic Web for the Working Ontologist";​ 
- dc:​publisher <​Elsevier>;​ 
- dc:​language "​en"​. ​ 
-# ... 
-</​code>​ 
-    * Hint: comprehensive list of ''​dcterms:''​ and ''​dc:''​ elements is [[http://​dublincore.org/​documents/​dcmi-terms/​|here]] ("​Section 2: Properties in the /terms/ namespace"​ = ''​dcterms:'',​ "​Properties in the /​elements/​1.1/​ namespace"​ = ''​dc:''​) 
- 
- 
-==== - RDF Schema: classes [10 minutes] ==== 
-RDF Schema allows to organize objects into classes and define simple taxonomies. 
- 
-  - Define classes of items in you multimedia library, e.g. 
-<​code>​ 
-@base   <​http://​kkutt/​mylibrary/>​ . 
-@prefix rdf: <​http://​www.w3.org/​1999/​02/​22-rdf-syntax-ns#>​ . 
-@prefix rdfs: <​http://​www.w3.org/​2000/​01/​rdf-schema#>​ . 
- 
-<​MultimediaItem>​ rdf:type rdfs:Class . 
- 
-<​MusicCD>​ rdf:type rdfs:Class ; 
- rdfs:​subClassOf <​MultimediaItem>​ . 
- 
-<​Book>​ rdf:type rdfs:Class ; 
- rdfs:​subClassOf <​MultimediaItem>​ . 
-</​code>​ 
- 
-Add the ''​rdf:​type''​ statements to your RDF file, e.g.: 
-<​code>​ 
-<​cd-rhcp_stadiumarcadium>​ <​artist>​ "Red Hot Chilli Peppers"​^^xsd:​string;​ 
- dc:title "​Stadium Arcadium"​^^xsd:​string;​ 
- dc:​language "​en";​ 
- rdf:type <​MusicCD>​. 
-</​code>​ 
- 
-Note that ''​a''​ is an alias for ''​rdf:​type''​ so two statements: <​code><​cd-rhcp_stadiumarcadium>​ rdf:type <​MusicCD>​.</​code><​code><​cd-rhcp_stadiumarcadium>​ a <​MusicCD>​.</​code>​ are equivalent. 
- 
-==== - RDF Schema: properties [10 minutes] ==== 
- 
-RDF Schema also provides a way to define Properties as well as their domains and ranges. 
- 
-  - In your file identify properties that are not defined in external dictionaries (e.g. Dublin Core), e.g. in this code:<​code>​ 
-<​cd-rhcp_stadiumarcadium>​ <​artist>​ "Red Hot Chilli Peppers"​^^xsd:​string;​ 
- dc:title "​Stadium Arcadium"​^^xsd:​string;​ 
- dc:​language "​en";​ 
- rdf:type <​MusicCD>​. 
-</​code>​ ''<​artist>''​ is not defined in external dictionary -- it is defined in our own namespace. 
-  - Describe each such property using RDF Schema capabilities:<​code>​ 
-@base   <​http://​kkutt/​mylibrary/>​ . 
-@prefix rdf: <​http://​www.w3.org/​1999/​02/​22-rdf-syntax-ns#>​ . 
-@prefix rdfs: <​http://​www.w3.org/​2000/​01/​rdf-schema#>​ . 
- 
-<​artist>​ rdf:type rdfs:​Property ; 
- rdfs:​domain <​MusicCD>​ ; 
- rdfs:range rdfs:​Literal. 
-</​code>​ 
- 
-You may find [[http://​www.w3.org/​TR/​rdf-schema/​|RDF Schema 1.1]] recommendation useful. 
- 
-==== - RDF Schema: Non-modeling properties [10 minutes] ==== 
- 
-RDF Schema also provides some handful properties that are not used in inference process. These are: 
-  * ''​rdfs:​label''​ -- used by convention to provide a human-readable name that is displayed by semantic web agents, 
-  * ''​rdfs:​seeAlso''​ -- cross-referencing;​ provide links to supplementary information,​ 
-  * ''​rdfs:​isDefinedBy''​ -- subPropertyOf rdfs:​seeAlso;​ provides a link to the primary source of information,​ 
-  * ''​rdfs:​comment''​ -- for everything you want :) . 
- 
-  - Use each of them in your RDF file. 
-  - 8-) Include final RDF **Turtle** file in the report archive. 
-    * Check if your Turtle file passes validation on <wrap caution>​[[http://​any23.org/​|Anything to Triples]]</​wrap>​! 
-===== Control questions ===== 
-   * What container elements are available in RDF? 
-   * What is RDF Schema? 
-   * What are core RDF Schema Classes and properties? 
-   * How constraints on domain and range of properties are added? 
- 
-===== Materials ===== 
- 
-{{section>​.:​rdfmodel#​if_you_want_to_know_more}} 
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0