You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Rose Beck <ro...@gmail.com> on 2015/04/12 15:23:11 UTC
Update the data type of inserted Named Graphs
I have entered my data into Jena in named graph form. By mistake the
named graphs inserted in Jena have type xsd:double for some literals.
Now I want to update all literals loaded in Jena which have type
xsd:double to type xsd:float. Is it possible to do the same? If yes,
how.
--
With Warm Regards,
Rose
Re: Update the data type of inserted Named Graphs
Posted by Andy Seaborne <an...@apache.org>.
On 12/04/15 19:39, Maria Jackson wrote:
> The size of my database is 100GB. It took me 4 days to construct the
> database and I have a deadline tomorrow,
Use doubles and cast in computation returns if double/float makes any
difference whatsoever.
[A]
> therefore I can not afford to load
> the entire database again.
>
> If possible, I'll be really grateful if you can explain how can I
> repeatedly apply LIMIT with the help of an example query.
DELETE { ?s ?p ?o }
INSERT { ?s ?p ?o2 }
WHERE
{
SELECT * {
?s ?p ?o .
FILTER(datatype(?o) = xsd:double)
BIND(STRDT(STR(?o), xsd:float) AS ?o2)
} LIMIT 1000000
}
Tune the value of limit.
Apply repeatedly until no change (ASK { ...} return false).
As it is a DB scan it'll get slower and slower as more is converted.
It is also churning the node table so it is not cheap.
Hence higher risk than [A]
Backup: tdbdump.
Andy
>
> Also can you please tell me the commands as to how can I dump the database
> and reload the database again. Perhpahs an example here can be useful too.
>
> On Mon, Apr 13, 2015 at 12:03 AM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 12/04/15 19:07, Rose Beck wrote:
>>
>>> Just to clarify: I know this is valid SPARQL and will only update the
>>> quads containing xsd:decimal as data-type in place. But what I am
>>> confused about is -- does Jena support this?
>>>
>>
>> Of course. Whether it is practical, depends on the size of the database.
>>
>> It will use a lot of memory for the transaction though. Repeated LIMIT
>> usage reduces the size needed.
>>
>> The dump-reload has the advantage producing a compact database.
>>
>> Andy
>>
>>
>>
>>> On Sun, Apr 12, 2015 at 11:34 PM, Rose Beck <ro...@gmail.com>
>>> wrote:
>>>
>>>> Or more specifically for named graphs:
>>>> DELETE { ?s ?p ?o }
>>>> INSERT { ?s ?p ?o2 }
>>>> WHERE
>>>> {
>>>> graph ?g{
>>>> ?s ?p ?o .
>>>> FILTER(datatype(?o) = xsd:double)
>>>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>>>> }}
>>>>
>>>> On Sun, Apr 12, 2015 at 11:31 PM, Rose Beck <ro...@gmail.com>
>>>> wrote:
>>>>
>>>>> Can something like given below work
>>>>>
>>>>> DELETE { ?s ?p ?o }
>>>>> INSERT { ?s ?p ?o2 }
>>>>> WHERE
>>>>> {
>>>>> ?s ?p ?o .
>>>>> FILTER(datatype(?o) = xsd:double)
>>>>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>>>>> }
>>>>>
>>>>>
>>>>> On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> On 12/04/15 14:23, Rose Beck wrote:
>>>>>>
>>>>>>>
>>>>>>> I have entered my data into Jena in named graph form. By mistake the
>>>>>>> named graphs inserted in Jena have type xsd:double for some literals.
>>>>>>> Now I want to update all literals loaded in Jena which have type
>>>>>>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>>>>>>> how.
>>>>>>>
>>>>>>>
>>>>>> Dump the database, run the dump file through a text stream editor (sed,
>>>>>> perl, ...) to change the data and reload.
>>>>>>
>>>>>> There isn't a quick, safe way to edit the DB files inplace.
>>>>>>
>>>>>> Andy
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> With Warm Regards,
>>>>> Rose
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> With Warm Regards,
>>>> Rose
>>>>
>>>
>>>
>>>
>>>
>>
>
Re: Update the data type of inserted Named Graphs
Posted by Maria Jackson <ma...@gmail.com>.
The size of my database is 100GB. It took me 4 days to construct the
database and I have a deadline tomorrow, therefore I can not afford to load
the entire database again.
If possible, I'll be really grateful if you can explain how can I
repeatedly apply LIMIT with the help of an example query.
Also can you please tell me the commands as to how can I dump the database
and reload the database again. Perhpahs an example here can be useful too.
On Mon, Apr 13, 2015 at 12:03 AM, Andy Seaborne <an...@apache.org> wrote:
> On 12/04/15 19:07, Rose Beck wrote:
>
>> Just to clarify: I know this is valid SPARQL and will only update the
>> quads containing xsd:decimal as data-type in place. But what I am
>> confused about is -- does Jena support this?
>>
>
> Of course. Whether it is practical, depends on the size of the database.
>
> It will use a lot of memory for the transaction though. Repeated LIMIT
> usage reduces the size needed.
>
> The dump-reload has the advantage producing a compact database.
>
> Andy
>
>
>
>> On Sun, Apr 12, 2015 at 11:34 PM, Rose Beck <ro...@gmail.com>
>> wrote:
>>
>>> Or more specifically for named graphs:
>>> DELETE { ?s ?p ?o }
>>> INSERT { ?s ?p ?o2 }
>>> WHERE
>>> {
>>> graph ?g{
>>> ?s ?p ?o .
>>> FILTER(datatype(?o) = xsd:double)
>>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>>> }}
>>>
>>> On Sun, Apr 12, 2015 at 11:31 PM, Rose Beck <ro...@gmail.com>
>>> wrote:
>>>
>>>> Can something like given below work
>>>>
>>>> DELETE { ?s ?p ?o }
>>>> INSERT { ?s ?p ?o2 }
>>>> WHERE
>>>> {
>>>> ?s ?p ?o .
>>>> FILTER(datatype(?o) = xsd:double)
>>>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>>>> }
>>>>
>>>>
>>>> On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org>
>>>> wrote:
>>>>
>>>>> On 12/04/15 14:23, Rose Beck wrote:
>>>>>
>>>>>>
>>>>>> I have entered my data into Jena in named graph form. By mistake the
>>>>>> named graphs inserted in Jena have type xsd:double for some literals.
>>>>>> Now I want to update all literals loaded in Jena which have type
>>>>>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>>>>>> how.
>>>>>>
>>>>>>
>>>>> Dump the database, run the dump file through a text stream editor (sed,
>>>>> perl, ...) to change the data and reload.
>>>>>
>>>>> There isn't a quick, safe way to edit the DB files inplace.
>>>>>
>>>>> Andy
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> With Warm Regards,
>>>> Rose
>>>>
>>>
>>>
>>>
>>> --
>>> With Warm Regards,
>>> Rose
>>>
>>
>>
>>
>>
>
Re: Update the data type of inserted Named Graphs
Posted by Andy Seaborne <an...@apache.org>.
On 12/04/15 19:07, Rose Beck wrote:
> Just to clarify: I know this is valid SPARQL and will only update the
> quads containing xsd:decimal as data-type in place. But what I am
> confused about is -- does Jena support this?
Of course. Whether it is practical, depends on the size of the database.
It will use a lot of memory for the transaction though. Repeated LIMIT
usage reduces the size needed.
The dump-reload has the advantage producing a compact database.
Andy
>
> On Sun, Apr 12, 2015 at 11:34 PM, Rose Beck <ro...@gmail.com> wrote:
>> Or more specifically for named graphs:
>> DELETE { ?s ?p ?o }
>> INSERT { ?s ?p ?o2 }
>> WHERE
>> {
>> graph ?g{
>> ?s ?p ?o .
>> FILTER(datatype(?o) = xsd:double)
>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>> }}
>>
>> On Sun, Apr 12, 2015 at 11:31 PM, Rose Beck <ro...@gmail.com> wrote:
>>> Can something like given below work
>>>
>>> DELETE { ?s ?p ?o }
>>> INSERT { ?s ?p ?o2 }
>>> WHERE
>>> {
>>> ?s ?p ?o .
>>> FILTER(datatype(?o) = xsd:double)
>>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>>> }
>>>
>>>
>>> On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>>> On 12/04/15 14:23, Rose Beck wrote:
>>>>>
>>>>> I have entered my data into Jena in named graph form. By mistake the
>>>>> named graphs inserted in Jena have type xsd:double for some literals.
>>>>> Now I want to update all literals loaded in Jena which have type
>>>>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>>>>> how.
>>>>>
>>>>
>>>> Dump the database, run the dump file through a text stream editor (sed,
>>>> perl, ...) to change the data and reload.
>>>>
>>>> There isn't a quick, safe way to edit the DB files inplace.
>>>>
>>>> Andy
>>>
>>>
>>>
>>> --
>>> With Warm Regards,
>>> Rose
>>
>>
>>
>> --
>> With Warm Regards,
>> Rose
>
>
>
Re: Update the data type of inserted Named Graphs
Posted by Rose Beck <ro...@gmail.com>.
Just to clarify: I know this is valid SPARQL and will only update the
quads containing xsd:decimal as data-type in place. But what I am
confused about is -- does Jena support this?
On Sun, Apr 12, 2015 at 11:34 PM, Rose Beck <ro...@gmail.com> wrote:
> Or more specifically for named graphs:
> DELETE { ?s ?p ?o }
> INSERT { ?s ?p ?o2 }
> WHERE
> {
> graph ?g{
> ?s ?p ?o .
> FILTER(datatype(?o) = xsd:double)
> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
> }}
>
> On Sun, Apr 12, 2015 at 11:31 PM, Rose Beck <ro...@gmail.com> wrote:
>> Can something like given below work
>>
>> DELETE { ?s ?p ?o }
>> INSERT { ?s ?p ?o2 }
>> WHERE
>> {
>> ?s ?p ?o .
>> FILTER(datatype(?o) = xsd:double)
>> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
>> }
>>
>>
>> On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org> wrote:
>>> On 12/04/15 14:23, Rose Beck wrote:
>>>>
>>>> I have entered my data into Jena in named graph form. By mistake the
>>>> named graphs inserted in Jena have type xsd:double for some literals.
>>>> Now I want to update all literals loaded in Jena which have type
>>>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>>>> how.
>>>>
>>>
>>> Dump the database, run the dump file through a text stream editor (sed,
>>> perl, ...) to change the data and reload.
>>>
>>> There isn't a quick, safe way to edit the DB files inplace.
>>>
>>> Andy
>>
>>
>>
>> --
>> With Warm Regards,
>> Rose
>
>
>
> --
> With Warm Regards,
> Rose
--
With Warm Regards,
Rose
Re: Update the data type of inserted Named Graphs
Posted by Rose Beck <ro...@gmail.com>.
Or more specifically for named graphs:
DELETE { ?s ?p ?o }
INSERT { ?s ?p ?o2 }
WHERE
{
graph ?g{
?s ?p ?o .
FILTER(datatype(?o) = xsd:double)
BIND(STRDT(STR(?o), xsd:float) AS ?o2)
}}
On Sun, Apr 12, 2015 at 11:31 PM, Rose Beck <ro...@gmail.com> wrote:
> Can something like given below work
>
> DELETE { ?s ?p ?o }
> INSERT { ?s ?p ?o2 }
> WHERE
> {
> ?s ?p ?o .
> FILTER(datatype(?o) = xsd:double)
> BIND(STRDT(STR(?o), xsd:float) AS ?o2)
> }
>
>
> On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org> wrote:
>> On 12/04/15 14:23, Rose Beck wrote:
>>>
>>> I have entered my data into Jena in named graph form. By mistake the
>>> named graphs inserted in Jena have type xsd:double for some literals.
>>> Now I want to update all literals loaded in Jena which have type
>>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>>> how.
>>>
>>
>> Dump the database, run the dump file through a text stream editor (sed,
>> perl, ...) to change the data and reload.
>>
>> There isn't a quick, safe way to edit the DB files inplace.
>>
>> Andy
>
>
>
> --
> With Warm Regards,
> Rose
--
With Warm Regards,
Rose
Re: Update the data type of inserted Named Graphs
Posted by Rose Beck <ro...@gmail.com>.
Can something like given below work
DELETE { ?s ?p ?o }
INSERT { ?s ?p ?o2 }
WHERE
{
?s ?p ?o .
FILTER(datatype(?o) = xsd:double)
BIND(STRDT(STR(?o), xsd:float) AS ?o2)
}
On Sun, Apr 12, 2015 at 11:00 PM, Andy Seaborne <an...@apache.org> wrote:
> On 12/04/15 14:23, Rose Beck wrote:
>>
>> I have entered my data into Jena in named graph form. By mistake the
>> named graphs inserted in Jena have type xsd:double for some literals.
>> Now I want to update all literals loaded in Jena which have type
>> xsd:double to type xsd:float. Is it possible to do the same? If yes,
>> how.
>>
>
> Dump the database, run the dump file through a text stream editor (sed,
> perl, ...) to change the data and reload.
>
> There isn't a quick, safe way to edit the DB files inplace.
>
> Andy
--
With Warm Regards,
Rose
Re: Update the data type of inserted Named Graphs
Posted by Andy Seaborne <an...@apache.org>.
On 12/04/15 14:23, Rose Beck wrote:
> I have entered my data into Jena in named graph form. By mistake the
> named graphs inserted in Jena have type xsd:double for some literals.
> Now I want to update all literals loaded in Jena which have type
> xsd:double to type xsd:float. Is it possible to do the same? If yes,
> how.
>
Dump the database, run the dump file through a text stream editor (sed,
perl, ...) to change the data and reload.
There isn't a quick, safe way to edit the DB files inplace.
Andy