ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Problem with running json-prolog:prolog to query an owl file

asked 2017-09-07 10:31:17 -0600

aAsoodeh gravatar image


I have a cram project running with Ros. i simply want to query an owl file and receive results in cram.

Knowrob is installed on my system and i can run rosrun rosprolog rosprolog knowrob_common examples.

Based on limited documentations and available codes, to query the owl file, i came up with the following code

(json-prolog:prolog '("rdf_has" ?owlname ""("literal")))

i received

; Evaluation aborted on #<SB-KERNEL:CASE-FAILURE expected-type: (OR STRING ROSLISP::URI) datum: NIL>.

i tried every permutation to place owl address, variable and owl command. same error showed up in all cases.

Moreover, by running (json-prolog:check-connection) i have the following error

[(JSON-PROLOG) WARN] 1504631904.665: Node is not running.

I am not sure which node i should run and is it neccessary in order to query the owl file?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-09-07 11:19:18 -0600

gaya gravatar image

updated 2017-09-07 11:24:43 -0600


Well, as your warning message suggests, your ROS node is not running. Without a ROS node you cannot do any ROS communication with other nodes. Simply start a new node:

(roslisp:start-ros-node "my_awesome_node")

and try the query again.

I have a suspicion, though, that the ("literal") clause will create problems. For beginners I usually suggest to use the json-prolog:prolog-simple query, which simply accepts a string instead of a list with the query and parameters as json-prolog:prolog does. E.g.:

(json-prolog:prolog-simple "rdf_has(OWLNAME, '', OTHERVAR).")

Edit: in case you're interested to know what the correct version of your original query is, this is how I would write it:

(json-prolog:prolog '("rdf_has" ?owlname "" ("literal" ?var)))
edit flag offensive delete link more

answered 2017-09-11 07:48:32 -0600

aAsoodeh gravatar image

Thanks Gaya,

I tried starting ros node. this is the result:

[(ROSLISP TOP) INFO] 1504894025.528: Node name is /my_awesome_node

[(ROSLISP TOP) INFO] 1504894025.528: Namespace is /

[(ROSLISP TOP) INFO] 1504894025.528: Params are NIL

[(ROSLISP TOP) INFO] 1504894025.528: Remappings are:

[(ROSLISP TOP) INFO] 1504894025.529: master URI is

[(ROSLISP TOP) INFO] 1504894026.547: Node startup complete


And when i tried check connenction it is still nil but there is no "Node is not running." Any idea?


edit flag offensive delete link more


Well, this looks fine. Your json prolog query still doesn't give the expected results?

gaya gravatar image gaya  ( 2017-09-11 07:55:10 -0600 )edit

No it said ros-rpc call failed with code -1, message no provider, values. [Condition of type ROSLISP::ROS-RPC-ERROR]

aAsoodeh gravatar image aAsoodeh  ( 2017-09-11 08:08:40 -0600 )edit

You need a json_prolog node service provider running. Such that when you do "rosservice list" it shows up in the list (as "json_prolog/query")

gaya gravatar image gaya  ( 2017-09-11 08:27:33 -0600 )edit

Thanks @gaya. right now i have the connection and service. the error that i have this time when i tried prolog-simple example is "Prolog query failed: Got error: The value RDF_HAS is not of type LIST.. [Condition of type SIMPLE-ERROR]" any idea?

aAsoodeh gravatar image aAsoodeh  ( 2017-09-12 09:08:35 -0600 )edit

also i have [(JSON-PROLOG) WARN] 1505226166.532: Service call failed. [(JSON-PROLOG) WARN] 1505226166.532: Retrying...

aAsoodeh gravatar image aAsoodeh  ( 2017-09-12 09:25:28 -0600 )edit

Question Tools



Asked: 2017-09-07 10:31:17 -0600

Seen: 203 times

Last updated: Sep 11 '17