My instances have names (screenshot of the said names in Protégé) and slots (image here).
What I need to do is: knowing the value of the slot "DESCRIPTION", getting the name of the instance so I can use it in my Java program.
I thought of a defrule
, but does it allow me to have the result in a global variable? Can you please guide me in doing this?
You can indeed use a rule in combination with a global:
(defglobal ?*desc* = "")
Write a rule:
(defrule getDescription
(SystemEauDeRefroidissement
(http..#description ?d))
=>
(bind ?*desc* ?d))
This might work if you have only a single instance of SystemEauDeRefroidissement
. You can retrieve the global's value using the Jess API:
Context ctxt = rete.getContext();
Variable var = ctxt.getVariable( "desc" );
String desc = var.stringValue( ctxt );
I haven't tested any of this.
Edit If you have the description, you may write a rule (now more in the Protégé style:
(object
(is-a http..#SystemEauDeRefroidissement)
(OBJECT ?sedr)
(http..#description ...)
=>
(bind ?*sedr* ?sedr))
I don't know how you'd like to insert the description value into the Jess environment, so that's why there's the ellipsis.