Commits

Sam Adams committed 66e62aa

Try to get title from cif

  • Participants
  • Parent commits 3e07b09

Comments (0)

Files changed (1)

src/main/java/uk/ac/cam/ch/wwmm/chempound/deposit/DepositCif.java

 package uk.ac.cam.ch.wwmm.chempound.deposit;
 
+import com.hp.hpl.jena.rdf.model.*;
+import com.hp.hpl.jena.rdf.model.Statement;
 import com.hp.hpl.jena.xmloutput.RDFXMLWriterI;
 import com.hp.hpl.jena.xmloutput.impl.Abbreviated;
 import nu.xom.ParsingException;
 import uk.ac.cam.ch.wwmm.chempound.content.DefaultContentLoadRequest;
 import uk.ac.cam.ch.wwmm.chempound.crystal.importer.CrystalStructureImporter;
 import uk.ac.cam.ch.wwmm.chempound.crystal.importer.utils.CifIO;
+import uk.ac.cam.ch.wwmm.chempound.rdf.DCTerms;
 import uk.ac.cam.ch.wwmm.chempound.storage.AggregatedResource;
 
+import javax.annotation.Resource;
 import java.io.*;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
         Deposit deposit = new Deposit();
 
         EntryPart entryPart = new EntryPart();
-        entryPart.getEntry().setTitle("Crystal Structure");
+        String title = "Crystal Structure";
 
         if (!request.getMetadataModel().isEmpty()) {
             attachMetaData(request, entryPart);
+            Statement s = request.getMetadataModel().getResource("").getRequiredProperty(DCTerms.title);
+            if (s != null) {
+                title = s.getString();
+            }
         }
+        entryPart.getEntry().setTitle(title);
         deposit.setEntryPart(entryPart);
 
         byte[] zip = createZipFile(request);