[dspace-tech] How-to: Calculate Collection and Community Sizes

2017-07-25 Thread Tom Hutchinson
Our DSpace admin recently asked me how to calculate the sizes of collections 
and communities. To my surprise, I couldn't immediately find an answer.

I wrote two PostgreSQL queries. To use them:

- optionally, first backup the database - for me that is:
sudo su - postgres -c 'pg_dump -U postgres -f /tmp/db_bkup.sql dspace'

- open a Postgres terminal - for me that is:
sudo su - postgres -c 'psql -U postgres dspace'

- Take one of the queries below, change the handle listed at the beginning, 
and paste into the postgres terminal. Be sure to copy the whole thing, 
starting with WITH and ending with ;

- When finished, quit the postgres terminal
\q

These are written for DSpace 5. I imagine they would work on DS6. For versions
before 5, they will work if you remove the lines ending with  --DS5. 
Note: -- signifies the beginning of a line comment in SQL.

Cheers

Tom

--Size of collection with name
--Replace 10066/1597 with the handle for your collection
WITH starting_col (handle) AS (VALUES ('10066/1597')) 
SELECT
   to_char((sum(bitstream.size_bytes::bigint) ) 
 / ( 1024 * 1024 * 1024 ), '.99' )  || 'GB' AS size
  , handle.handle
  , text_value --DS5
FROM   handle 
JOIN starting_col 
  ON handle.handle = starting_col.handle
JOIN collection 
  ON handle.resource_id = collection.collection_id 
 AND handle.resource_type_id = 3  
JOIN collection2item 
  ON collection.collection_id = collection2item.collection_id 
JOIN item 
  ON collection2item.item_id = item.item_id 
JOIN item2bundle 
  ON item.item_id = item2bundle.item_id 
JOIN bundle 
  ON item2bundle.bundle_id = bundle.bundle_id 
JOIN bundle2bitstream 
  ON bundle.bundle_id = bundle2bitstream.bundle_id 
JOIN bitstream 
  ON bundle2bitstream.bitstream_id = bitstream.bitstream_id
JOIN metadatavalue --DS5
  ON handle.resource_id = metadatavalue.resource_id--DS5
 AND handle.resource_type_id = metadatavalue.resource_type_id  --DS5
WHERE metadatavalue.metadata_field_id = 64 --DS5
GROUP BY handle.handle
   , text_value--DS5
;



--Size of a community, including sub-communities and collections
--Replace 10066/1597 with the handle for your community
WITH starting_comm AS
(SELECT handle.handle, handle.resource_id AS community_id 
   FROM handle
  WHERE handle.resource_type_id = 4
AND handle = '10066/27')

SELECT size, handle
   , text_value AS community--DS5
FROM
(
  SELECT
 to_char((sum(bitstream.size_bytes::bigint) )
   / ( 1024 * 1024 * 1024 ), '.99' )  || 'GB' AS size 
  FROM
  (

  WITH RECURSIVE descendants(parent) AS (
SELECT parent_comm_id
FROM community2community
WHERE parent_comm_id = (SELECT community_id FROM starting_comm)
  UNION
SELECT community2community.child_comm_id
FROM descendants
JOIN community2community
  ON descendants.parent = community2community.parent_comm_id
  )

  SELECT DISTINCT item_id
  FROM descendants
  JOIN community2item comm2i
ON descendants.parent = comm2i.community_id

  UNION

  SELECT DISTINCT item_id
  FROM descendants
  JOIN community2collection comm2col
ON descendants.parent = comm2col.community_id
  JOIN collection2item col2i
ON comm2col.collection_id = col2i.collection_id

  ) items

  JOIN item2bundle
ON   items.item_id = item2bundle.item_id
  JOIN bundle
ON   item2bundle.bundle_id = bundle.bundle_id
  JOIN bundle2bitstream
ON   bundle.bundle_id = bundle2bitstream.bundle_id
  JOIN bitstream
ON   bundle2bitstream.bitstream_id = bitstream.bitstream_id
) supersize,
(SELECT * 
  FROM starting_comm
  JOIN metadatavalue--DS5
 ON starting_comm.community_id = metadatavalue.resource_id  --DS5
AND metadatavalue.resource_type_id = 4  --DS5
AND metadatavalue.metadata_field_id = 64--DS5
) sc;


--To automatically calculate units, replace these lines:
   to_char((sum(bitstream.size_bytes::bigint) ) 
 / ( 1024 * 1024 * 1024 ), '.99' )  || 'GB' AS size

--With these:
  CASE 
WHEN  sum(bitstream.size_bytes::bigint)::bigint 
  >= (1024::bigint*1024*1024*1024)
THEN  to_char(
sum(bitstream.size_bytes::bigint)::bigint 
/ (1024::bigint*1024*1024*1024), '.99' || 'TB')

WHEN  sum(bitstream.size_bytes::bigint)::bigint 
  >= (1024::bigint*1024*1024)
THEN  to_char(
  sum(bitstream.size_bytes::bigint)::bigint 
  / (1024::bigint*1024*1024), '.99' || 'GB')

WHEN  sum(bitstream.size_bytes::bigint)::bigint 
  >= (1024::bigint*1024)
THEN  to_char(
sum(bitstream.size_bytes::bigint)::bigint 
/ (1024::bigint*1024), '.99' || 'MB')

WHEN  sum(bitstream.size_bytes::bigint)::bigint >= 

[dspace-tech] Google Analytics dspace 5.6

2017-07-25 Thread christian criollo
Hi all

I want to know if in dspace 5.6 jspui is possible enable the module the 
Google Analytics and how can i configure this feature?

Thanks for the help

-- 
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] Author profiles for XMLUI

2017-07-25 Thread Evelthon Prodromou
Hello everyone,

Just wondering, I was looking into development projects and saw Author 
Profiles XMLUI 
. Anyone 
knows what is the status of this project?

Thanks.

-- 
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] flush changes immediately to database

2017-07-25 Thread Stefan Fritzsche

Hi,

i try to set the status of an DSpaceObject in the database. When the 
status is set the objects has the right status but in the database is 
the old status. I try to fire an MODIFY event in the setter and after 
that i make a context.dispatchEvent() call but nothing happends in the 
DB. I also try to use context.commit but after this call i got a lazy 
object initialisation error.


How can commit the changes immediately to database?

Thanks,
Stefan

--
Stefan Fritzsche
Fachinformatiker/digitale Archivierung

Technische Universität Dresden
Zentrum für Informationsdienste und Hochleistungsrechnen
Abt: Verteiltes und Datenintensives Rechnen
01062 Dresden

Tel.: +49 351 463-33212
E-Mail: stefan.fritzs...@tu-dresden.de


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


smime.p7s
Description: S/MIME Cryptographic Signature