Re: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

2016-11-11 Thread Alan Orth
Thanks, Terry. The code in this pull request actually merges cleanly into
DSpace 5.5. Now I *have* to try it. :)

https://github.com/DSpace/DSpace/pull/1532

Cheers,

On Thu, Nov 10, 2016 at 6:34 PM Terry Brady 
wrote:

> Alan,
>
> If you are interested in the new REST Query functionality that is a part
> of DSpace 6, I have some documentation on how to port that functionality
> into DSpace 5.
>
>
> https://wiki.duraspace.org/display/DSDOC6x/REST+Based+Quality+Control+Reports#RESTBasedQualityControlReports-InstallinginDSpace5
>
> Terry
>
> On Thu, Nov 10, 2016 at 7:26 AM, Alan Orth  wrote:
>
> Thanks, Ilja.
>
> Now that you mention permissions issues, I have seen some errors
> suggesting that in dspace.log after I do the REST query:
>
> ERROR org.dspace.rest.ItemsResource @ User(anonymous) has not permission
> to read item!
>
> But it's weird that in my case I see MORE items in the REST results than
> are actually in the database! Does REST query the database directly, or is
> there some cache somewhere I can clear, an index I can update, etc?
>
> Looking forward to getting our stack to DSpace 6, but it won't be until
> mid 2017 at this rate. :(
>
> Cheers,
>
> On Thu, Nov 10, 2016 at 3:01 PM Ilja Sidoroff 
> wrote:
>
> Hi,
>
> I tried to do something similar (all items with something in the field X),
> but it seems that find-by-metadata-field does not support wildcards, only
> exact matches. Helix84 suggested SOLR for me, There's also a new REST api
> for reports in 6.0 (Terry Brady suggested that to me). You can probably
> find the threads with my name & those mentioned.
>
> For the other question, are there differences in the item access
> permissions and/or if any of the items are in the workflow or in the
> collections. I think the SQL queries will give you all the items, but I
> think there is some filtering done with the REST - didn't look very deeply
> into that, though.
>
> Ilja
>
> ________
> From: dspace-tech@googlegroups.com  on
> behalf of Alan Orth 
> Sent: Thursday, November 10, 2016 1:38:34 PM
> To: DSpace Technical Support
> Subject: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5
>
> Hi,
>
> We're trying to build an application that uses metadata from DSpace's REST
> API and I'm having some issues. We're testing on DSpace 5.5 with PostgreSQL.
>
> First, it seems there is no way to use a wildcard value with the
> find-by-metadata-field endpoint—I want all items where a field
> `cg.subject.ilri` exists. Second, for another query, I'm not sure that the
> API is returning the correct results. Taking into account the text_lang of
> the metadata, the following database queries and REST API results don't add
> up. Here are the database results for null, blank, and en_US text_lang
> values:
>
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang is null;
>  count
> ---
> 15
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang='';
>  count
> ---
>  4
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang='en_US';
>  count
> ---
> 66
>
> Then the API results, in the order of null, blank, and en_US language:
>
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS"}' | jq length
> 55
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS", "language":""}' | jq length
> 34
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS", "language":"en_US"}' | jq length
>
> The results don't even remotely match, and there are actually more results
> from the API than from the database (85 vs 89).
>
> Does anyone know what's up

Re: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

2016-11-10 Thread Terry Brady
Alan,

If you are interested in the new REST Query functionality that is a part of
DSpace 6, I have some documentation on how to port that functionality into
DSpace 5.

https://wiki.duraspace.org/display/DSDOC6x/REST+Based+Quality+Control+Reports#RESTBasedQualityControlReports-InstallinginDSpace5

Terry

On Thu, Nov 10, 2016 at 7:26 AM, Alan Orth  wrote:

> Thanks, Ilja.
>
> Now that you mention permissions issues, I have seen some errors
> suggesting that in dspace.log after I do the REST query:
>
> ERROR org.dspace.rest.ItemsResource @ User(anonymous) has not permission
> to read item!
>
> But it's weird that in my case I see MORE items in the REST results than
> are actually in the database! Does REST query the database directly, or is
> there some cache somewhere I can clear, an index I can update, etc?
>
> Looking forward to getting our stack to DSpace 6, but it won't be until
> mid 2017 at this rate. :(
>
> Cheers,
>
> On Thu, Nov 10, 2016 at 3:01 PM Ilja Sidoroff 
> wrote:
>
>> Hi,
>>
>> I tried to do something similar (all items with something in the field
>> X), but it seems that find-by-metadata-field does not support wildcards,
>> only exact matches. Helix84 suggested SOLR for me, There's also a new REST
>> api for reports in 6.0 (Terry Brady suggested that to me). You can probably
>> find the threads with my name & those mentioned.
>>
>> For the other question, are there differences in the item access
>> permissions and/or if any of the items are in the workflow or in the
>> collections. I think the SQL queries will give you all the items, but I
>> think there is some filtering done with the REST - didn't look very deeply
>> into that, though.
>>
>> Ilja
>>
>> ____________
>> From: dspace-tech@googlegroups.com  on
>> behalf of Alan Orth 
>> Sent: Thursday, November 10, 2016 1:38:34 PM
>> To: DSpace Technical Support
>> Subject: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5
>>
>> Hi,
>>
>> We're trying to build an application that uses metadata from DSpace's
>> REST API and I'm having some issues. We're testing on DSpace 5.5 with
>> PostgreSQL.
>>
>> First, it seems there is no way to use a wildcard value with the
>> find-by-metadata-field endpoint—I want all items where a field
>> `cg.subject.ilri` exists. Second, for another query, I'm not sure that the
>> API is returning the correct results. Taking into account the text_lang of
>> the metadata, the following database queries and REST API results don't add
>> up. Here are the database results for null, blank, and en_US text_lang
>> values:
>>
>> dspace=# select count(text_value) from metadatavalue where
>> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
>> text_lang is null;
>>  count
>> ---
>> 15
>> dspace=# select count(text_value) from metadatavalue where
>> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
>> text_lang='';
>>  count
>> ---
>>  4
>> dspace=# select count(text_value) from metadatavalue where
>> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
>> text_lang='en_US';
>>  count
>> ---
>> 66
>>
>> Then the API results, in the order of null, blank, and en_US language:
>>
>> $ curl -s -H "accept: application/json" -H "Content-Type:
>> application/json" -X POST "http://localhost:8080/rest/
>> items/find-by-metadata-field" -d '{"key": "cg.subject.ilri","value":
>> "SEEDS"}' | jq length
>> 55
>> $ curl -s -H "accept: application/json" -H "Content-Type:
>> application/json" -X POST "http://localhost:8080/rest/
>> items/find-by-metadata-field" -d '{"key": "cg.subject.ilri","value":
>> "SEEDS", "language":""}' | jq length
>> 34
>> $ curl -s -H "accept: application/json" -H "Content-Type:
>> application/json" -X POST "http://localhost:8080/rest/
>> items/find-by-metadata-field" -d '{"key": "cg.subject.ilri","value":
>> "SEEDS", "language":"en_US"}' | jq length
>>
>> The results don't even remotely match, and there are actually more
>> results from the API than from the database (85 vs 89).
>>
>> Does a

Re: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

2016-11-10 Thread Alan Orth
Thanks, Ilja.

Now that you mention permissions issues, I have seen some errors suggesting
that in dspace.log after I do the REST query:

ERROR org.dspace.rest.ItemsResource @ User(anonymous) has not permission to
read item!

But it's weird that in my case I see MORE items in the REST results than
are actually in the database! Does REST query the database directly, or is
there some cache somewhere I can clear, an index I can update, etc?

Looking forward to getting our stack to DSpace 6, but it won't be until mid
2017 at this rate. :(

Cheers,

On Thu, Nov 10, 2016 at 3:01 PM Ilja Sidoroff  wrote:

> Hi,
>
> I tried to do something similar (all items with something in the field X),
> but it seems that find-by-metadata-field does not support wildcards, only
> exact matches. Helix84 suggested SOLR for me, There's also a new REST api
> for reports in 6.0 (Terry Brady suggested that to me). You can probably
> find the threads with my name & those mentioned.
>
> For the other question, are there differences in the item access
> permissions and/or if any of the items are in the workflow or in the
> collections. I think the SQL queries will give you all the items, but I
> think there is some filtering done with the REST - didn't look very deeply
> into that, though.
>
> Ilja
>
> 
> From: dspace-tech@googlegroups.com  on
> behalf of Alan Orth 
> Sent: Thursday, November 10, 2016 1:38:34 PM
> To: DSpace Technical Support
> Subject: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5
>
> Hi,
>
> We're trying to build an application that uses metadata from DSpace's REST
> API and I'm having some issues. We're testing on DSpace 5.5 with PostgreSQL.
>
> First, it seems there is no way to use a wildcard value with the
> find-by-metadata-field endpoint—I want all items where a field
> `cg.subject.ilri` exists. Second, for another query, I'm not sure that the
> API is returning the correct results. Taking into account the text_lang of
> the metadata, the following database queries and REST API results don't add
> up. Here are the database results for null, blank, and en_US text_lang
> values:
>
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang is null;
>  count
> ---
> 15
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang='';
>  count
> ---
>  4
> dspace=# select count(text_value) from metadatavalue where
> resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
> text_lang='en_US';
>  count
> ---
> 66
>
> Then the API results, in the order of null, blank, and en_US language:
>
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS"}' | jq length
> 55
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS", "language":""}' | jq length
> 34
> $ curl -s -H "accept: application/json" -H "Content-Type:
> application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key":
> "cg.subject.ilri","value": "SEEDS", "language":"en_US"}' | jq length
>
> The results don't even remotely match, and there are actually more results
> from the API than from the database (85 vs 89).
>
> Does anyone know what's up with either of these issues? Thanks,
> --
>
> Alan Orth
> alan.o...@gmail.com<mailto:alan.o...@gmail.com>
> https://englishbulgaria.net
> https://alaninkenya.org
> https://mjanja.ch
>
> --
> You received this message because you are subscribed to the Google Groups
> "DSpace Technical Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dspace-tech+unsubscr...@googlegroups.com dspace-tech+unsubscr...@googlegroups.com>.
> To post to this group, send email to dspace-tech@googlegroups.com dspace-tech@googlegroups.com>.
> Visit this group at https://groups.google.com/group/dspace-tech.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Alan Orth
alan.o...@gmail.com
https://englishbulgaria.net
https://alaninkenya.org
https://mjanja.ch

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.


Re: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

2016-11-10 Thread Ilja Sidoroff
Hi,

I tried to do something similar (all items with something in the field X), but 
it seems that find-by-metadata-field does not support wildcards, only exact 
matches. Helix84 suggested SOLR for me, There's also a new REST api for reports 
in 6.0 (Terry Brady suggested that to me). You can probably find the threads 
with my name & those mentioned.

For the other question, are there differences in the item access permissions 
and/or if any of the items are in the workflow or in the collections. I think 
the SQL queries will give you all the items, but I think there is some 
filtering done with the REST - didn't look very deeply into that, though.

Ilja


From: dspace-tech@googlegroups.com  on behalf of 
Alan Orth 
Sent: Thursday, November 10, 2016 1:38:34 PM
To: DSpace Technical Support
Subject: [dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

Hi,

We're trying to build an application that uses metadata from DSpace's REST API 
and I'm having some issues. We're testing on DSpace 5.5 with PostgreSQL.

First, it seems there is no way to use a wildcard value with the 
find-by-metadata-field endpoint—I want all items where a field 
`cg.subject.ilri` exists. Second, for another query, I'm not sure that the API 
is returning the correct results. Taking into account the text_lang of the 
metadata, the following database queries and REST API results don't add up. 
Here are the database results for null, blank, and en_US text_lang values:

dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang is null;
 count
---
15
dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang='';
 count
---
 4
dspace=# select count(text_value) from metadatavalue where resource_type_id=2 
and metadata_field_id=203 and text_value='SEEDS' and text_lang='en_US';
 count
---
66

Then the API results, in the order of null, blank, and en_US language:

$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS"}' | jq length
55
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS", "language":""}' | jq length
34
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X 
POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d '{"key": 
"cg.subject.ilri","value": "SEEDS", "language":"en_US"}' | jq length

The results don't even remotely match, and there are actually more results from 
the API than from the database (85 vs 89).

Does anyone know what's up with either of these issues? Thanks,
--

Alan Orth
alan.o...@gmail.com<mailto:alan.o...@gmail.com>
https://englishbulgaria.net
https://alaninkenya.org
https://mjanja.ch

--
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
dspace-tech+unsubscr...@googlegroups.com<mailto:dspace-tech+unsubscr...@googlegroups.com>.
To post to this group, send email to 
dspace-tech@googlegroups.com<mailto:dspace-tech@googlegroups.com>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.


[dspace-tech] Issues with REST find-by-metadata-field in DSpace 5

2016-11-10 Thread Alan Orth
Hi,

We're trying to build an application that uses metadata from DSpace's REST
API and I'm having some issues. We're testing on DSpace 5.5 with PostgreSQL.

First, it seems there is no way to use a wildcard value with the
find-by-metadata-field endpoint—I want all items where a field
`cg.subject.ilri` exists. Second, for another query, I'm not sure that the
API is returning the correct results. Taking into account the text_lang of
the metadata, the following database queries and REST API results don't add
up. Here are the database results for null, blank, and en_US text_lang
values:

dspace=# select count(text_value) from metadatavalue where
resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
text_lang is null;
 count
---
15
dspace=# select count(text_value) from metadatavalue where
resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
text_lang='';
 count
---
 4
dspace=# select count(text_value) from metadatavalue where
resource_type_id=2 and metadata_field_id=203 and text_value='SEEDS' and
text_lang='en_US';
 count
---
66

Then the API results, in the order of null, blank, and en_US language:

$ curl -s -H "accept: application/json" -H "Content-Type: application/json"
-X POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d
'{"key": "cg.subject.ilri","value": "SEEDS"}' | jq length
55
$ curl -s -H "accept: application/json" -H "Content-Type: application/json"
-X POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d
'{"key": "cg.subject.ilri","value": "SEEDS", "language":""}' | jq length
34
$ curl -s -H "accept: application/json" -H "Content-Type: application/json"
-X POST "http://localhost:8080/rest/items/find-by-metadata-field"; -d
'{"key": "cg.subject.ilri","value": "SEEDS", "language":"en_US"}' | jq
length

The results don't even remotely match, and there are actually more results
from the API than from the database (85 vs 89).

Does anyone know what's up with either of these issues? Thanks,
-- 

Alan Orth
alan.o...@gmail.com
https://englishbulgaria.net
https://alaninkenya.org
https://mjanja.ch

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.