Hi

I am a newbie to Jena.

I want to be able to add rdf statements to my model in two different  .java
classes; ie Parser.java and Annotator.java

I did the following:

public class Parser {

    

    public static Model model = ModelFactory.createDefaultModel();

 

 

   Resource Product = model.createResource(ItemAddress);

 

//create the properties

Property category1 = model.createProperty("http:   .);

Property category2 = model.createProperty("http:   .);

Property category3 = model.createProperty("http:   .);

.

.

.

Property category_n = model.createProperty("http:   .);

 

//add  object

Product.addProperty(category1,     );

Product.addProperty(category2,     );

.

.

.

 

}

 

I want to load values for category_n in a method of the second  class:

 

public class Annotator{

 

   private static void printAnnotations(JsonNode annotations){

        for (JsonNode annotation : annotations){

 

       System.out.println("       something here");

 

Product.addProperty(category_n, classDetails.get(    );

 

  }

}

 

Note that the loop in the printAnnotations method will create multiple rdf
statements with same pair resource/predicate and multiple objects.

 

I tried passing the model in a parameter list from Parser.java.  It did not
work

Annotator.printAnnotations(model).

 

I thought making the model public would make this work.

 

Should I use an array in Annotator to collect the values in the loop?

 

Thanks for the help.

Mona

 

Reply via email to