Hi Keith,
The general queries you'd be creating in DSpace 5.x would be similar to
this one:
"SELECT * from metadatavalue WHERE resource_id=? and resource_type_id=?"
The "resource_id" is the 'id' field from the community/collection/item
tables (e.g. community_id, collection_id, etc)
The "resource_type_id" is the Type ID constant from here:
https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/core/Constants.java#L20
(i.e. Community = 4, Collection = 3, Item = 2)
That above query would give you *all* of the metadata fields for that
object. Then you'd want to join with the "metadatafieldregistry" using
the "metadata_field_id", based on the field you want to select.
In the end, it'd be something like this to select a community title
SELECT metadatavalue.text_value from metadatavalue,
metadatafieldregistry WHERE resource_id=? AND resource_type_id=4 AND
metadatavalue.metadata_field_id=metadatafieldregistry.metadata_field_id
AND metadatafieldregistry.element='title' AND
metadatafieldregistry.qualifier IS NULL;
(In the above SQL though I'm assuming you only have *one* 'title'
element, and not others in a different schema. So, it's better practice
to also use the "metadataschemaregistry" to limit by the 'dc' schema)
I hope that helps.
- Tim
On 2/1/2016 10:22 AM, Keith Jones wrote:
Hi All,
I've have a support program running for dspace that creates some
custom stats and sends out emails to users who subscribe to the custom
stats.
The report is generated by handles. In versions prior dspace 5.0, I
used the handle to get the community/collection/item name. In older
database structure I was able to get the community name from the
community table and the collection name from the collection table. The
new database structure no longer has the "name" field in community and
collection table.
My research indicates these values are now stored in the metadatavalue
table.
I'm looking for help putting together database calls to pull out the
name(title) of a Community, Collection and Item.
Any help would be appreciated.
Keith
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
--
Tim Donohue
Technical Lead for DSpace & DSpaceDirect
DuraSpace.org | DSpace.org | DSpaceDirect.org
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.