4 Replies Latest reply: Aug 19, 2011 10:41 AM by 880207 RSS

    Using Bag in Jena

    880207
      Hi ,

      Can you let me know when to use Bag(a practical scenario)? Also is there any inbuilt mechanism/rulebase inside Bag which works similar to inverseOf or any other rule's? I am using Jena.

      Bag belongs to com.hp.hpl.jena.rdf.model.Bag

      Thanks and Regards,
      Manish Hardasmalani

      Edited by: Manish Hardasmalani on Aug 16, 2011 5:20 AM
        • 1. Re: Using Bag in Jena
          alwu-Oracle
          Hi Manish,

          RDF Bag is not so widely used in practice. It's a bit hard to generate and query. A more common way is to define a property like :containsElement (and on which you can easily define an owl:inverseOf, for example, :elementContainedBy)

          Thanks,

          Zhe Wu
          • 2. Re: Using Bag in Jena
            880207
            Hi Zhe,

            I have my Model's stored in Oracle DB as triples.
            I want to create some rules like inverseOf , contains using jena as i dont want to create rules on DB side.
            Is there anyway i can do that on jena side or using owl.

            It would be great if you could share a simple example of using owl with jena for my reference.

            Thanks and Regards,
            Manish Hardasmalani
            • 3. Re: Using Bag in Jena
              alwu-Oracle
              Hi Manish,

              Here is a sketch illustrating the idea.

              GraphOracleSem oracleGraph = ... you need to use attachment with OWLPRIME ...

              graph.add(new Triple(
              Node.createURI("http://my.com/contains"),
              Node.createURI("http://www.w3.org/2002/07/owl#inverseOf"),
              Node.createURI("http://my.com/containedBy")
              )
              );

              graph.add(new Triple(
              Node.createURI("http://my.com/MyBagXYZ"),
              Node.createURI("http://my.com/contains"),
              Node.createURI("http://my.com/item1")
              )
              );

              ...
              oracleGraph.performInference();

              // After inference, you will see iterm1 containedBy MyBagXYZ

              For details on GraphOracleSem, data loading, and performInference, please refer to Chapter 7 of the following document.

              http://download.oracle.com/docs/cd/E16338_01/appdev.112/e11828.pdf

              Thanks,

              Zhe Wu
              • 4. Re: Using Bag in Jena
                880207
                Hi Zhe,

                Thanks. it helped me working in my code.

                Regards,
                Manish H