This content has been marked as final. Show 7 replies
You can either use the functional form
or the verbose version
InferInstance(<relationship>, <identity>) if <condition>
Probably the easiest trap to fall into is to try to use the entity text instead of the relationship. The relationship to use is the relationship where the entity instances you want to create are the target. Usually this is the containment relationship from the parent to the entity instance.
<relationship> (<indentity>) exists if <condition>
Global --> all instances of the person --> the person
The rule below creates an inferred entity with an id of "fred" if the boolean condition "the interview is for fred" is true"
InferInstance(all instances of the person, “fred”) if
the interview is for fred
See help topic "Write rules that infer relationships and entities" (within OPM go to Help | OPM USer's Guide) - it has example rules (including inferring conditionally) and points you at 4 example projects provided with the install that show you how it's done :-)1 person found this helpful
Edited by: Fiona Guy on Apr 5, 2013 9:48 AM
i am creating an entity instances using the statement...
InferInstance(the person's employment,”1”) but I am getting error..
"Inferred entity instances cannot be manually created"
my rule base has below relationshiop..
the person's employment.
Now the person entity is created by java code and im trying to create the employment entity using the rulebase but i am getting the above error.
any workaround or ideas..to achieve this...
Edited by: Rajan.Panchal on Apr 6, 2013 4:15 AM
Is it possible that you are trying to manually add something to the employment entity after it has been inferred. When an entity is inferred, all its attributes, child entities and relationships including this entity must also be inferred.1 person found this helpful
You cannot infer some aspects of an inferred entity and try to set others.
Creating a instance using an inferencing listener and then inferring child entities of that instance is definitely possible.
I have some base level attributes in the employment entity which i need to determine in rulebase and send it to java program..
what do you actually mean by
"Is it possible that you are trying to manually add something to the employment entity after it has been inferred. When an entity is inferred, all its attributes, child entities and relationships including this entity must also be inferred.
You cannot infer some aspects of an inferred entity and try to set others."
Can you please elaborate...
Edited by: Rajan.Panchal on Apr 7, 2013 8:31 PM
For example, you cannot prompt a user to supply values for an inferred entity instance. And you cannot provide entities in a SOAP API call for an entity that is inferred.
Rajan.Panchal wrote:You cannot infer some aspects of an inferred entity and try to set others. Can you please elaborate...
Sorry for the long delay in replying Rajan, I missed your request to elaborate.
To be specific:
When an entity instance is inferred that means that every attribute in it must also be inferred. The rule engine cannot cope with logic like: "this entity might or might not exist, but if it does, we need to ask for more information about it"
There are a few ways to deal with setting information in an inferred entity:
- most obviously infer any values from other entiy attributes in the session.
- set attribute values on related, non-inferred entities and then use rules infer those attributes on the inferred entity.
Its worth having a think about what the inferred entity instances means. If you want to use the rules as a convenient way to create an entity instance and you still need to set non-inferred attributes, then you are better off using an inferencing listener to create the instances.
If the instances are truly derivable from rules, then any attribute values of those instances are probably also derivable.