Hi Ilja 

I have a script that given a metadata field, e.g. pu.workflow.state, produces a 
tab separated list so: 

field   id      handle  value
pu.workflow.state       969     99999/fk4w099v32        approved
pu.workflow.state       903     null    emailed
pu.workflow.state       753     null    emailed
pu.workflow.state       752     null    emailed
pu.workflow.state       902     null    orphaned


The script is written in jruby and based on my dspace-jruby gem, see Script 
here 
<https://github.com/akinom/dspace-cli/blob/master/metadata/list_values.rb>. 
The gem as well as the script are available from github:   jrdspace gem 
<https://github.com/akinom/dspace-jruby>.  and cli-dspace 
<https://github.com/akinom/dspace-cli> , which has a bunch of other scripts.

The script is quite small, its ‘action’ is in the doit method 
def doit(metadata_field)
  puts ['field', 'id', 'handle', 'value'].join("\t")
  dsos = DSpace.findByMetadataValue(metadata_field, nil, DConstants::ITEM)
  dsos.each  do  |dso|
    vals = dso.getMetadataByMetadataString(metadata_field).collect { |v| 
v.value }
    puts [metadata_field, dso.getID, dso.getHandle.nil? ? "null" : 
dso.getHandle, vals  ].join("\t")
  end
end
if you want to try this out , there are instructions on GitHUb. If you want to 
work in Java, look at the implementation of the DSpace.findByMetadataValue  
method. It has the SQL statement. see HERE 
<https://github.com/akinom/dspace-jruby/blob/master/lib/dspace/dspace.rb#L150-L171>
 

Monika

—
Monika Mevenkamp
Digital Repository Infrastructure Developer
Princeton University
Phone: 609-258-4161
Skype: mo-meven



> On Sep 1, 2016, at 6:43 AM, Ilja Sidoroff <ilja.sidor...@uef.fi> wrote:
> 
> Hello,
> 
> I am using DSpace 5.5.
> 
> Am I correct, that SOLR queries return only items that are in
> *collections* and not in the *workflow*? At least my search attemps
> indicate that?
> 
> In the REST API, however, it seems that GET /items returns only
> results that are in the collections. However, with POST
> /items/find-by-metadata-field I can get all items in the DSpace, both
> those in the collections and those in the workflow?
> 
> What I need, is a list of *all items* (both in the workflow and the
> collections) that have certain metadata field set and *the value of
> that field*. I don't see other way of doing that, except by direct SQL
> query to the database. I have one for 5.x, but I'm not happy with it
> since, I need to update it for 6.x etc. Is there any other way of
> doing this?
> 
> Also, it seems that
> 
> dspace import -d -m mapfile ...
> 
> does not delete items currently in the workflow? Is this intentional or a bug?
> 
> regards,
> 
> Ilja Sidoroff
> University of Eastern Finland
> 
> -- 
> 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.

-- 
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.

Reply via email to