semantic web assignment 2

6
Semantic Web Assignment 2 Studentname: Barry Kollee Student number: 10349863 Student username: UvA student ([email protected]) Assignment name: WebKR Assignment 2 Developing an OWL ontology with Protege 1. Chose the domain of your ontology My domain is ‘Apple devices specifications’. 2. Define two classes using restrictions as shown in lecture 3 iPhone capacities (device is available in only 16, 32 and 64 gb.) o {16gb, 32gB, 64gB} iPod colors(device has only the colors red, blue, pink, green, gray, black) o {red, blue, pink, green, gray, black} 3. Imagine at least 3 instances of these classes. For each instance, write a triple in which you assign a value to one of the preoperties used in the restrictions above. (i.e subject = the instance, predicate = the property used in the restriction object = the value that you chose) The property for the iPod is hasColors. The property for the iPhone is hasCapacity. 4. Load your ontology into Protege. My code written with turtle syntax: @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix ex: <http://www.example.org/> . :iPhone rdf:type owl:Class ;

Upload: barryk88

Post on 07-Dec-2014

898 views

Category:

Documents


2 download

DESCRIPTION

Assignment 2 of the course Semantic web

TRANSCRIPT

Page 1: Semantic web assignment 2

Semantic  Web  Assignment  2  Studentname:       Barry  Kollee  Student  number:     10349863  Student  username:     UvA  student  ([email protected])  Assignment  name:     WebKR  Assignment  2    

Developing  an  OWL  ontology  with  Protege  

1.  Chose  the  domain  of  your  ontology  

My  domain  is  ‘Apple  devices  specifications’.    2.  Define  two  classes  using  restrictions  as  shown  in  lecture  3    

• iPhone  capacities  (device  is  available  in  only  16,  32  and  64  gb.)  o {16gb,  32gB,  64gB}  

• iPod  colors(device  has  only  the  colors  red,  blue,  pink,  green,  gray,  black)  o {red,  blue,  pink,  green,  gray,  black}  

 3.  Imagine  at  least  3  instances  of  these  classes.  For  each  instance,  write  a  triple  in  which  you  assign  a  value  to  one  of  the  preoperties  used  in  the  restrictions  above.  (i.e  subject  =  the  instance,  predicate  =  the  property  used  in  the  restriction  object  =  the  value  that  you  chose)    

• The  property  for  the  iPod  is  hasColors.  • The  property  for  the  iPhone  is  hasCapacity.  

   4.  Load  your  ontology  into  Protege.    My  code  written  with  turtle  syntax:    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix ex: <http://www.example.org/> . :iPhone rdf:type owl:Class ;

Page 2: Semantic web assignment 2

rdfs:label "iPhone" ; rdfs:subClassOf :Specifications , [ rdf:type owl:Restriction ; owl:onProperty ex:hasCapacity ; owl:allValuesFrom ex:Capacity ; ] ; owl:disjointWith ex:Capacity. :iPod rdf:type owl:Class ; rdfs:label "iPod" ; rdfs:subClassOf :Specifications , [ rdf:type owl:Restriction ; owl:onProperty ex:hasColors ; owl:allValuesFrom ex:Colors . ] ; owl:disjointWith ex:Colors . ex:16gB rdf:type ex:Capacity . ex:32gB rdf:type ex:Capacity . ex:64gB rdf:type ex:Capacity . ex:red rdf:type ex:Colors . ex:blue rdf:type ex:Colors . ex:pink rdf:type ex:Colors . ex:green rdf:type ex:Colors . ex:gray rdf:type ex:Colors . ex:black rdf:type ex:Colors .

       5.  Show  that  Protege  classifes  your  instances  correctly.      

 

Page 3: Semantic web assignment 2

 

Page 4: Semantic web assignment 2

 Output  of  the  Class  Hierarchy  (OntoGraf)  with  Protégé  4.1  

 6.  Explain  which  type  of  restriction  you  used.  owl:someValuesFrom,  owl:allValuesFrom,  owl:hasValue,  owl:cardinality    I’ve  used  owl:  allValuesFrom  for  both  of  my  classes.  You  would  be  unable  to  predict  if  an  iPhone  has  a  specific  capacity  or  not.  For  that  reason  I’ve  chosen  for  owl:allValuesFrom  which  results  in  all  the  possible  results;  in  this  case  the  iPhone  capacities.    On  the  other  hand  we  have  the  iPod  hasColors:  property.  The  reason  for  choosing  owl:allValuesFrom  is  equal  as  my  explanation  for  choosing  it  with  the  iPhone.  You  would  be  unable  to  predict  if  iPod’s  have  one  Color  or  more.  With  owl:allValuesFrom  we  cover  the  whole  list.    7.  Did  you  use  necessary  or  necessary  and  sufficient  conditions?    I  used  sufficient  conditions,  because  you  can’t  be  sure  what  kind  of  Colors  of  Capacities  you  will  find  under  Capacity  and  Colors.    

SPARQL  

Perform  3  queries  on  http://www.dbpedia.org.  You  can  use  one  of  their  web  interfaces  to  perform  the  queries  either  http://dbpedia.org/snorql/  or  http://dbpedia.org/sparql  .  Alternatively,  you  can  use  ARQ.  Hand  in  the  3  queries  along  with  the  results  for  each  query.  You  should  show  examples  of  both  schema  queries  and  regular  queries.  Identify,  which  queries  are  schema  queries  and  which  ones  are  regular.  Try  at  least  one  query  that  is  not  a  select  query  (e.g  a  construct  or  ask  query).    

Page 5: Semantic web assignment 2

First  Query:  Select  Query  for  the  Semantic_Web  (abstract)    SELECT ?abstract WHERE { { <http://dbpedia.org/resource/Semantic_Web> <http://dbpedia.org/ontology/abstract> ?abstract } }  Gives  me  several  results  (all  kinds  of  languages).  The  English  one  gives:    "The  Semantic  Web  is  a  collaborative  movement  led  by  the  World  Wide  Web  Consortium  (W3C)  that  promotes  common  formats  for  data  on  the  World  Wide  Web.  By  encouraging  the  inclusion  of  semantic  content  in  web  pages,  the  Semantic  Web  aims  at  converting  the  current  web  of  unstructured  documents  into  a  "web  of  data".  It  builds  on  the  W3C's  Resource  Description  Framework  (RDF).  According  to  the  W3C,  "The  Semantic  Web  provides  a  common  framework  that  allows  data  to  be  shared  and  reused  across  application,  enterprise,  and  community  boundaries.  "  The  term  was  coined  by  Tim  Berners-­‐Lee,  the  inventor  of  the  World  Wide  Web  and  director  of  the  World  Wide  Web  Consortium,  which  oversees  the  development  of  proposed  Semantic  Web  standards.  He  defines  the  Semantic  Web  as  "a  web  of  data  that  can  be  processed  directly  and  indirectly  by  machines.  "  While  its  critics  have  questioned  its  feasibility,  proponents  argue  that  applications  in  industry,  biology  and  human  sciences  research  have  already  proven  the  validity  of  the  original  concept.  Scholars  have  explored  the  social  potential  of  the  semantic  web  in  the  business  and  health  sectors,  and  for  social  networking.  The  original  2001  Scientific  American  article  by  Berners-­‐Lee  described  an  expected  evolution  of  the  existing  Web  to  a  Semantic  Web,  but  this  has  yet  to  happen.  In  2006,  Berners-­‐Lee  and  colleagues  stated  that:  "This  simple  idea...  remains  largely  unrealized.""@en1    Second  Query:  Select  Query  for  Concepts  of  DBPedia  (with  a  limit  of  5  results)2    SELECT  DISTINCT  ?Concept  where  {?s  a  ?Concept}  LIMIT  5    This  Query  gives  me  this  result:                Third  Query:  Comparing  the  height  of  the  Eiffel  Tower  to  the  Rocky  Mountains    PREFIX prop: <http://dbpedia.org/property/> ASK { <http://dbpedia.org/resource/Eiffel_Tower> prop:height ?eiffel . <http://dbpedia.org/resource/Rocky_Mountains> prop:height ?rocky . FILTER(?eiffel > ?rocky) . }  Gives  me  the  result  true.  

                                                                                                               1  http://dbpedia.org/sparql?default-­‐graph-­‐uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fabstract%0D%0AWHERE+{%0D%0A{+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FSemantic_Web%3E+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2Fabstract%3E+%3Fabstract+}%0D%0A}%0D%0A&format=text%2Fhtml&timeout=0&debug=on;  result  of  Quering  http://dbpedia.org/resource/Semantic_Web    2  http://www.cambridgesemantics.com/semantic-­‐university/sparql-­‐by-­‐example      

Page 6: Semantic web assignment 2

 PREFIX prop: <http://dbpedia.org/property/> ASK { <http://dbpedia.org/resource/Eiffel_Tower> prop:height ?eiffel . <http://dbpedia.org/resource/Rocky_Mountains> prop:height ?rocky . FILTER(?eiffel < ?rocky) . }          Gives  me  the  result  false.    The  reults  which  I  retrieved  from  the  Select  query  of  the  concepts  gave  me  a  schema  because  I  used  a  metaclass  which  identifies  my  query  as  a  schema  query.3    

Joseki    Set  up  Joseki  (http://www.joseki.org/)  You'll  _nd  instructions  on  black-­‐  board.  Load  your  ontology  into  Joseki.  Write  one  sparql  sparql  query  that  you  can  run  over  your  ontology.  Show  the  results  of  running  those  queries  against  your  ontology.    Unfortunately  I  was  unable  to  get  Joseki  running  on  my  Mac.  It  could  be  because  of  compatibility  issues.  (I’ve  got  mountain  Lyon  installed).    However  I  did  some  research  on  a  possible  query  for  querying  the  iPod  color.  Which  I  could  not  test  unfortunately.4    PREFIX : <http://www.w3.org/2011/12/appledevicespecifications.owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?color FROM <http://www.w3.org/2011/12/appledevicespecifications.owl> WHERE { ?iPod rdf:type/rdfs:subClassOf* color:Colors . }  

                                                                                                               3  http://msdn.microsoft.com/en-­‐us/library/windows/desktop/aa393278%28v=vs.85%29.aspx    4  http://www.cambridgesemantics.com/semantic-­‐university/sparql-­‐by-­‐example