Discussion:
creating rdf file on disk using java
tina sani
2016-06-18 23:40:32 UTC
Permalink
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
A. Soroka
2016-06-19 06:44:06 UTC
Permalink
Please start with the documentation provided for exactly this purpose:

https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/

---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
tina sani
2016-06-19 09:57:53 UTC
Permalink
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.

What I needed is to create an rdf file locally on disk using Jena code and
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.

Thank you

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
A. Soroka
2016-06-19 10:09:32 UTC
Permalink
Can you show some actual example code that you are trying to use? Otherwise it's difficult to say what is not right.

---
A. Soroka
The University of Virginia Library
Post by tina sani
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.
What I needed is to create an rdf file locally on disk using Jena code and
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.
Thank you
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
tina sani
2016-06-19 19:14:20 UTC
Permalink
I do not have currently code in hand but my scenario is that I have created
an ontology for university library having information about book details,
authors, employee working in library. I will read the file in Jena code
later.

But I want to keep track of each student login to the system i-e what type
of book they search usually, at what time he visits the system so I need a
file holding just name and her Id to uniquely identify her.
I have created a file using Java (as mentioned in previous email) but dont
know how to store student login information in it?

The student does not have to register first so need for database, just keep
track of her name/ID to find their preference?

Thank you
Post by A. Soroka
Can you show some actual example code that you are trying to use?
Otherwise it's difficult to say what is not right.
---
A. Soroka
The University of Virginia Library
Post by tina sani
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.
What I needed is to create an rdf file locally on disk using Jena code
and
Post by tina sani
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.
Thank you
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
Virus-free.
www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
Lorenz B.
2016-06-20 06:17:14 UTC
Permalink
We can not help you without seeing the code. You already call
model.save() which writes the model as RDF to disk. If your file is
empty, something goes wrong with your code that adds triples to the model.

Lorenz
Post by tina sani
I do not have currently code in hand but my scenario is that I have created
an ontology for university library having information about book details,
authors, employee working in library. I will read the file in Jena code
later.
But I want to keep track of each student login to the system i-e what type
of book they search usually, at what time he visits the system so I need a
file holding just name and her Id to uniquely identify her.
I have created a file using Java (as mentioned in previous email) but dont
know how to store student login information in it?
The student does not have to register first so need for database, just keep
track of her name/ID to find their preference?
Thank you
Post by A. Soroka
Can you show some actual example code that you are trying to use?
Otherwise it's difficult to say what is not right.
---
A. Soroka
The University of Virginia Library
Post by tina sani
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.
What I needed is to create an rdf file locally on disk using Jena code
and
Post by tina sani
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.
Thank you
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
Virus-free.
www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
John A. Fereira
2016-06-20 12:29:31 UTC
Permalink
Yes. Since the rdf file is being created but is empty, that implies that the problem lies in adding statements to the model. There are lots of examples one can find by searching for “jena write rdf example”, including an example in the Jena release:

https://github.com/apache/jena/blob/master/jena-core/src-examples/jena/examples/rdf/Tutorial04.java
Post by Lorenz B.
We can not help you without seeing the code. You already call
model.save() which writes the model as RDF to disk. If your file is
empty, something goes wrong with your code that adds triples to the model.
Lorenz
Post by tina sani
I do not have currently code in hand but my scenario is that I have created
an ontology for university library having information about book details,
authors, employee working in library. I will read the file in Jena code
later.
But I want to keep track of each student login to the system i-e what type
of book they search usually, at what time he visits the system so I need a
file holding just name and her Id to uniquely identify her.
I have created a file using Java (as mentioned in previous email) but dont
know how to store student login information in it?
The student does not have to register first so need for database, just keep
track of her name/ID to find their preference?
Thank you
Post by A. Soroka
Can you show some actual example code that you are trying to use?
Otherwise it's difficult to say what is not right.
---
A. Soroka
The University of Virginia Library
Post by tina sani
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.
What I needed is to create an rdf file locally on disk using Jena code
and
Post by tina sani
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.
Thank you
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
Virus-free.
www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web resear
Dave Reynolds
2016-06-20 20:02:34 UTC
Permalink
Another, hopefully remote, possibility might be a failure to close the
output stream (if the data is smaller than the output buffer).

Dave
Post by John A. Fereira
https://github.com/apache/jena/blob/master/jena-core/src-examples/jena/examples/rdf/Tutorial04.java
Post by Lorenz B.
We can not help you without seeing the code. You already call
model.save() which writes the model as RDF to disk. If your file is
empty, something goes wrong with your code that adds triples to the model.
Lorenz
Post by tina sani
I do not have currently code in hand but my scenario is that I have created
an ontology for university library having information about book details,
authors, employee working in library. I will read the file in Jena code
later.
But I want to keep track of each student login to the system i-e what type
of book they search usually, at what time he visits the system so I need a
file holding just name and her Id to uniquely identify her.
I have created a file using Java (as mentioned in previous email) but dont
know how to store student login information in it?
The student does not have to register first so need for database, just keep
track of her name/ID to find their preference?
Thank you
Post by A. Soroka
Can you show some actual example code that you are trying to use?
Otherwise it's difficult to say what is not right.
---
A. Soroka
The University of Virginia Library
Post by tina sani
Actually I have already read this documentation but I did not find what I
am looking for exactly. In documentation, it includes something like
this :model.write(System.out);
which only writes a model to a file.
What I needed is to create an rdf file locally on disk using Jena code
and
Post by tina sani
then store some users data inside that file. Like
FileOutputStream fout=new FileOutputStream(
"C:\\desktop//tina.rdf");
model.write(fout);
The file on my desktop is actually created but it is an empty file but I
want some input from users and store it in this file which currently I am
not sure how to do it.
Thank you
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
Virus-free.
www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Post by tina sani
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Post by A. Soroka
https://jena.apache.org/tutorials/rdf_api.html
https://jena.apache.org/getting_started/
---
A. Soroka
The University of Virginia Library
Post by tina sani
Hello all.
How can I create an RDF file using Jena and then save some data like
student name. address etc?
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Loading...