rdf_save Question

26 views
Skip to first unread message

brolog

unread,
Feb 28, 2016, 8:45:31 PM2/28/16
to SWI-Prolog
Hello,

I am trying to use rdf_save/1 to save some changes I made to my rdf triple store in Prolog. However, some namespace declarations are not being saved into my new file, so I get a bunch of errors when I try to load my new file. Wondering if maybe I'm doing something wrong or if there is any way to get the namespaces saved as they are in the original file? I tried saving via rdf_save/2 but I can't figure out exactly how to use the namespaces option (keeps returning 'false').

Thanks!

Jan Wielemaker

unread,
Feb 29, 2016, 2:53:14 AM2/29/16
to brolog, SWI-Prolog
I vaguely recall there is a problem with this, although I do not have a
reproducible case. I'd use rdf_save_turtle/2. RDF/XML is old school.
If you can provide me with a reproducible case for the RDF/XML version,
please share it.

Cheers --- Jan
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

brolog

unread,
Feb 29, 2016, 2:44:46 PM2/29/16
to swi-p...@googlegroups.com, r.sh...@gmail.com
Hi Jan, thanks for replying.

Using rdf_save_turtle/2 then loading the file with load_turtle/1 works. I can work with this for now, thank you for the suggestion. 

I've uploaded a sample of my RDF file which produced the errors after saving via rdf_save if you would like to reproduce the errors I'm getting. If you load the attached into Prolog, perform rdf_save, and try to load the new file it will bring up a bunch of errors.

edit: Missing my init file... but my geonames namespace is not declared in the new file.

On Monday, February 29, 2016 at 2:53:14 AM UTC-5, Jan Wielemaker wrote:
I vaguely recall there is a problem with this, although I do not have a
reproducible case.  I'd use rdf_save_turtle/2.  RDF/XML is old school.
If you can provide me with a reproducible case for the RDF/XML version,
please share it.

        Cheers --- Jan

On 02/29/2016 02:45 AM, brolog wrote:
> Hello,
>
> I am trying to use rdf_save/1 to save some changes I made to my rdf
> triple store in Prolog. However, some namespace declarations are not
> being saved into my new file, so I get a bunch of errors when I try to
> load my new file. Wondering if maybe I'm doing something wrong or if
> there is any way to get the namespaces saved as they are in the original
> file? I tried saving via rdf_save/2 but I can't figure out exactly how
> to use the namespaces option (keeps returning 'false').
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
FinalRDF.rdf

Jan Wielemaker

unread,
Mar 2, 2016, 5:57:56 AM3/2/16
to brolog, SWI-Prolog
Hmm ... Using the below little program and your data, I can read,
save and re-read your data consistently without errors. Rapper
can also read the output. Using SWI-Prolog 7.3.17. What are
you doing differently? Possibly you have registered prefixes?
Which?

Cheers --- Jan

:- use_module(library(semweb/rdf_db)).

l :-
rdf_load('FinalRDF.rdf').

s :-
rdf_save('test.rdf', []).

rl :-
rdf_reset_db,
rdf_load('test.rdf').



On 02/29/2016 08:44 PM, brolog wrote:
> Hi Jan, thanks for replying.
>
> Using rdf_save_turtle/2 then loading the file with load_turtle/1 works.
> I can work with this for now, thank you for the suggestion.
>
> I've uploaded a sample of my RDF file which produced the errors after
> saving via rdf_save if you would like to reproduce the errors I'm
> getting. If you load the attached into Prolog, perform rdf_save, and try
> to load the new file it will bring up a bunch of errors.
>
>
> On Monday, February 29, 2016 at 2:53:14 AM UTC-5, Jan Wielemaker wrote:
>
> I vaguely recall there is a problem with this, although I do not have a
> reproducible case. I'd use rdf_save_turtle/2. RDF/XML is old school.
> If you can provide me with a reproducible case for the RDF/XML version,
> please share it.
>
> Cheers --- Jan
>
> On 02/29/2016 02:45 AM, brolog wrote:
> > Hello,
> >
> > I am trying to use rdf_save/1 to save some changes I made to my rdf
> > triple store in Prolog. However, some namespace declarations are not
> > being saved into my new file, so I get a bunch of errors when I
> try to
> > load my new file. Wondering if maybe I'm doing something wrong or if
> > there is any way to get the namespaces saved as they are in the
> original
> > file? I tried saving via rdf_save/2 but I can't figure out
> exactly how
> > to use the namespaces option (keeps returning 'false').
> >
> > Thanks!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "SWI-Prolog" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to swi-prolog+...@googlegroups.com <javascript:>
> > <mailto:swi-prolog+...@googlegroups.com <javascript:>>.
> <https://groups.google.com/group/swi-prolog>.
> > For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.

Carlo Capelli

unread,
Mar 2, 2016, 8:41:31 AM3/2/16
to Jan Wielemaker, brolog, SWI-Prolog
not sure if this is a problem, but it reads 160 triples from FinalRDF.rdf, but saves (and reloads) only 157.
I will try to understand better using rdf_equal_graphs

Carlo


To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.

Jan Wielemaker

unread,
Mar 2, 2016, 8:48:16 AM3/2/16
to Carlo Capelli, brolog, SWI-Prolog
On 03/02/2016 02:41 PM, Carlo Capelli wrote:
> not sure if this is a problem, but it reads 160 triples from
> FinalRDF.rdf, but saves (and reloads) only 157.
> I will try to understand better using *rdf_equal_graphs*

1 ?- l.
% Parsed "FinalRDF.rdf" in 0.01 sec; 160 triples
true.

2 ?- aggregate_all(count, rdf(_,_,_), C).
C = 157.

3 ?- aggregate_all(count, rdf(_,_,_,_), C).
C = 160.

I.e., the file contains three duplicates. Saving deletes
duplicate triples.

Cheers --- Jan

brolog

unread,
Mar 2, 2016, 2:22:21 PM3/2/16
to SWI-Prolog, r.sh...@gmail.com
I actually have a lot of prefixes registered. Here they are:

:- rdf_register_prefix(gd, 'http://www.linkedgeodata.org/ontology/').
:- rdf_register_prefix(ge, 'http://sws.geonames.org/'). % database of geonames
:- rdf_register_prefix(ot, 'http://www.w3.org/2006/time#').
:- rdf_register_prefix(wgs84, 'http://www.w3.org/2003/01/geo/wgs84_pos#'). % source Longitude and Latitude
:- rdf_register_prefix(gn, 'http://www.geonames.org/ontology#').
:- rdf_register_prefix(ssfo, 'http://ontology.eil.utoronto.ca/ssf/ssf.owl#').
>      > <mailto:swi-prolog+unsub...@googlegroups.com <javascript:>>.
>      > Visit this group at https://groups.google.com/group/swi-prolog
>     <https://groups.google.com/group/swi-prolog>.
>      > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages