jenaowljena-rules

Check if property is defined in jena rules


In apache jena (using rules), how do I print when finding an instance that does not have a specified object property (in a single rule)?

Example (print people without a job):

[ruleNoJob: (?p rdf:type :Person) ... -> print(?p, 'does not have a job')]


Solution

  • You can use "noValue". Example code below:

    [ruleNoJob: (?p rdf:type :Person), noValue(?p aa:job) -> print(?p, 'does not have a job')]