7 Replies Latest reply on Mar 27, 2014 9:12 AM by Jocelyn Duc

    Identify variables, create triples and store them through a custom marshaling strategy

    Jocelyn Duc Novice

      Hello,

       

      Last days I was trying to store my variables to an external triplestore database, for a semantic usage. The following explanations helped me and I think this is the best way to accomplish my goal:

      jBPM 6 - store your process variables anywhere | Accelerate your business | Planet JBoss Community

      jBPM and semantic web

       

      Using a triplestore database is meaning that I have to deal with triples formatted variables. So, for example, to save a firstname, I have to provide a similar triple:

      • Subject: a person with a certain ID
      • Predicate: hasFirstname
      • Object: the litteral "Mary"

       

      In reference to the links above, I have to extend jBPM by creating a new ResolverStrategy which will be able to marshall/unmarshall triple. A ResolverStrategy starts with an accept(Object o) method which determinates if the given object will be marshalled/unmarshalled by the strategy. If not, the default strategy will do it. In this case, if I set objects of custom type "Triple" as process variables in my BPM, my custom strategy will catch them thanks to the "instance of" keyword. So, for now, all Triple objects in my BPM can be handled.

       

      The problem with this method is that I have to use several custom type objects in my diagram. I would like to use the standard primitives jBPM types. I would my form to output a String and not a Triple.I would like to keep something as generic as possible, Where the end user won't have to create special type to get it working. But the solution will have to create and save triple as background. In other words, the modelling of the diagram should not be dependent of the triplestore and the user should be able to design using standard types.

       

      So, I need your advice. A value arrive into the accept method... and what next? How to determine this is a firstname and that is has to be saved as predicate "hasFirstname"? How to determine who has this firstname, since values arrives ones after the others in the accept method? My problem is kindly how to identify the given values...? Passing a Person object is easy, but how to do it with standard types?

       

      Any idea will be useful!

       

      Thank you!