Ask Your Question
0

How to create OWL file that can query by knowrob normally?

asked 2012-08-03 03:47:00 -0600

sam gravatar image

updated 2012-08-03 22:53:33 -0600

I followed knowrob tutorials.

I create an owl file sam_world.owl by protege.

  <?xml version="1.0"?>


  <!DOCTYPE Ontology [
      <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
      <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
      <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
      <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
  ]>


  <Ontology xmlns="http://www.w3.org/2002/07/owl#"
       xml:base="http://www.semanticweb.org/ira/ontologies/2012/7/untitled-ontology-4"
       xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:xml="http://www.w3.org/XML/1998/namespace"
       ontologyIRI="http://www.semanticweb.org/ira/ontologies/2012/7/untitled-ontology-4">
      <Prefix name="" IRI="http://www.w3.org/2002/07/owl#"/>
      <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
      <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
      <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
      <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
      <Declaration>
          <Class IRI="#book"/>
      </Declaration>
      <Declaration>
          <Class IRI="#cup"/>
      </Declaration>
      <Declaration>
          <Class IRI="#flower"/>
      </Declaration>
      <Declaration>
          <Class IRI="#outside"/>
      </Declaration>
      <Declaration>
          <Class IRI="#room"/>
      </Declaration>
      <Declaration>
          <Class IRI="#sidewalk"/>
      </Declaration>
      <SubClassOf>
          <Class IRI="#book"/>
          <Class IRI="#room"/>
      </SubClassOf>
      <SubClassOf>
          <Class IRI="#cup"/>
          <Class IRI="#room"/>
      </SubClassOf>
      <SubClassOf>
          <Class IRI="#flower"/>
          <Class IRI="#outside"/>
      </SubClassOf>
      <SubClassOf>
          <Class IRI="#sidewalk"/>
          <Class IRI="#outside"/>
      </SubClassOf>
  </Ontology>



  <!-- Generated by the OWL API (version 3.3.1957) http://owlapi.sourceforge.net -->

And I load knowrob:

  rosrun rosprolog rosprolog mod_vis

Then I load my own owl file and query it...

It shows many warnings and one query error:

  ?- owl_parser:owl_parse('/home/sam/code/ros/sam_ai/sam_owl/sam_world.owl', false, false, true).
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:12: Unexpected element http://www.w3.org/2002/07/owl# : Ontology
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:19: Unexpected element http://www.w3.org/2002/07/owl# : Prefix
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:20: Unexpected element http://www.w3.org/2002/07/owl# : Prefix
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:21: Unexpected element http://www.w3.org/2002/07/owl# : Prefix
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:22: Unexpected element http://www.w3.org/2002/07/owl# : Prefix
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:23: Unexpected element http://www.w3.org/2002/07/owl# : Prefix
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:24: Unexpected element http://www.w3.org/2002/07/owl# : Declaration
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:25: Unexpected element http://www.w3.org/2002/07/owl# : Class
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:27: Unexpected element http://www.w3.org/2002/07/owl# : Declaration
  Warning: RDF: file:///home/sam/code/ros/sam_ai/sam_owl/sam_world.owl:28: Unexpected element http ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-08-03 04:36:44 -0600

moritz gravatar image

Hi,

you need to save the files in RDF/XML syntax; the one in the example looks different...

cheers Moritz

edit flag offensive delete link more

Comments

Thank you~Now I can load owl normally,but still can query because of couldn't find namespace. How to solve it?

sam gravatar imagesam ( 2012-08-03 21:55:27 -0600 )edit

Can you please post a (possibly shortened) version of your file, explain how you load it, and how you try to query? Otherwise, it's impossible to find the problem...

moritz gravatar imagemoritz ( 2012-08-03 22:03:09 -0600 )edit

I have edited the original post. I use the same way to load owl file.

sam gravatar imagesam ( 2012-08-03 22:54:22 -0600 )edit

You can register namespaces using :- rdf_db:rdf_register_ns(sam_world2, 'http://www.semanticweb.org/ira/ontologies/2012/7/untitled-ontology-4#', [keep(true)]). This is not specific to knowrob, but part of the Semweb library in SWI Prolog http://www.swi-prolog.org/pldoc/package/semweb.html

moritz gravatar imagemoritz ( 2012-08-03 22:59:28 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-08-03 03:47:00 -0600

Seen: 853 times

Last updated: Aug 03 '12