Hi,
The  the RDF triple example you give is just a matter of format.

But anyway according to ur words, I think what you want is to generate a
single file with the format u want, and I will tell you how to generate it.
Forget the protege I've just mentioned, and

follow the following codes and try to adapt to ur codes.

Create three class, 1) define ur concept/schema 2) contain the main
function and generate rdf data  3) output a file u want :
--------------------------------------------

1)  CustomizedSchema.java

// define ur class, conceptual level thing,
Public class CustomizedSchema {
        public static final String URI = "http://
your_URI<http://define_your_URI>
";

private static Model m = (Model) ModelFactory.createDefaultModel();

// define the properties, public static final Property propertyName1 =
m.createProperty(URI, "propertyname1");
public static final Property propertyName2= m.createProperty(URI,
"propertyname2");
       // and so on...
 }

2) MainGenerator.java
public class MainGenerator {

   public static final String URI = "http:// your_URI<http://define_your_URI>
";

 Model model = ModelFactory.createDefaultModel();
Resource sub = model.createResource(URI+"subName");
 model.add(sub, CustomizedSchema.propertyName,"ur value");

GenerateRDFFile.writeModel(model);

}


3) GenerateRDFFile.java
public class GenerateRDFFile {

 public static void writeModel(Model model){ File f = new File("give a rdf
file path and name"); Model modelBase; try{ //read the old data.rdf
if(f.exists()){ modelBase = FileManager.get().loadModel(rdfDataName); }
else{ modelBase = ModelFactory.createDefaultModel(); } Model uniform =
modelBase.union(model); OutputStream out = new FileOutputStream(f); //write
and close; uniform.write(out,"TURTLE"); out.close(); } catch (Exception e){
System.out.println("Error:"+e.getMessage()); } }
}


------------------------------------------
That's all, right?

Hope you can succeed, :)

Best regards,
Dongsheng wang


}






On Sat, Feb 15, 2014 at 12:43 AM, Soniya Kumar <[email protected]> wrote:

> Hi,
>
> Thanks a lot for the reply. I will try to generate the vocabulary file. My
> next question would, once i load the owl/rdf file for the conceptual level
> class using jena, how can i add the values to properties?
>
> Like in the file, the value 16 of the task <task:day> is obtained at
> runtime in the application. I would like to have the final RDF triples like
> this
>
> Subject:task  predicate:day Object:16
>
> So that my final aim is to store these triples in a RDF triple store.
>
> Hope you can help me more.
> Thanks and kind regards,
> Soniya
>
>
> On Fri, Feb 14, 2014 at 5:27 PM, Wang Dongsheng <[email protected]
> >wrote:
>
> > Hi Soniya,
> >
> > It seems not difficult to implement.
> >
> > From my experience, it's better to use protege (a visualization tool) to
> > create a vocabulary class as an additional file. We generally view it as
> > conceptual level class.
> >
> > Then, u can load the rdf/owl file with jena. The individual level data
> > could be generated if you know rdf syntax as you want.
> >
> > I don't learn about ur thesis. If you have any more questions u can
> contact
> > me directly, I'd be glad to help you if you want.
> >
> > Dongsheng wang
> >
> >
> >
> > On Fri, Feb 14, 2014 at 11:39 PM, Soniya Kumar <[email protected]>
> > wrote:
> >
> > > Hello,
> > >
> > > I am a master student in Saarland university in Germany. I am working
> on
> > > my master thesis and I have to get an RDF implementation done.
> > >
> > >
> > > I have been trying to understand Jena as well as RDF using the RDF
> > primar.
> > > But I am not able to move forward from this point:
> > >
> > >
> > > I know how my RDF file should look like but I am not sure how to create
> > > this one using Jena.
> > >
> > >
> > > I have attached the RDF file in here. In this, for example, the tag
> > > <task:day>16</task:day>
> > > The resource task can be predefined.
> > > The property day is obtained from the application.
> > > The value 16 is obtained from my main application.
> > >
> > > I tried to create a new vocabulary class for Task with properties
> > > day,end_month and so on, so that I can enter the values for these
> > > properties during runtime.
> > >
> > > I was not successful in creating a vocabulary class. Could you please
> > > explain to me how should i go about this situation.
> > >
> > > Is creating a new vocabulary class customized to my application the
> right
> > > approach? If yes, how should create one and how can use it while
> creating
> > > the final RDF file.
> > >
> > > Hope I would get some advices to how to solve this issues.
> > >
> > > Thanks and kind regards,
> > > Soniya
> > >
> > >
> > > --
> > > Soniya Vijayakumar
> > > M.Sc Student
> > > ===============================
> > > Computer and Communication Technology
> > > Universität des Saarlandes
> > > D-66123 Saarbücken
> > > Mob: +49 176 7383 8056
> > > ===============================
> > >
> >
>
>
>
> --
> Soniya Vijayakumar
> M.Sc Student
> ===============================
> Computer and Communication Technology
> Universität des Saarlandes
> D-66123 Saarbücken
> Mob: +49 176 7383 8056
> ===============================
>

Reply via email to