Package org.culturegraph.registry.importers

Examples of org.culturegraph.registry.importers.MarcImporter


  public void testNewPropertyRecord() throws FileNotFoundException {
    MarcXmlReader marcXmlReader = new MarcXmlReader(new FileInputStream(
        new File("test/input/singleOne.xml")));
    Record marcRecord = marcXmlReader.next();
    logger.info(marcRecord);
    MarcImporter marcImporter = new MarcImporter();
    HashMap<String, String> mappings = new HashMap<String, String>();
    marcImporter.setMappings(mappings);
    mappings.put("001", "_id");
    mappings.put("001", "localeIdentifierDNB");
    mappings.put("010 $a", "xbib://identifierAuthorityLOC");
    mappings.put("016", "xbib://identifierAuthority");
    mappings.put("035 $a", "xbib://identifierAuthorityEKI");
    mappings.put("100 $0", "dc:creator");
    mappings.put("245 $a", "dc:title");
    mappings.put("502 $o", "xbib://identifierUniversityScript");
    PropertyRecord propertyRecord = marcImporter
        .newPropertyRecord(marcRecord);
    assertEquals(4, propertyRecord.size());
    logger.info(propertyRecord);
  }
View Full Code Here


    assertEquals(4, propertyRecord.size());
    logger.info(propertyRecord);
  }

  public void testImportMarcXml() throws IOException, CultureGraphException {
    MarcImporter marcImporter = new MarcImporter();
    HashMap<String, String> mappings = new HashMap<String, String>();
    marcImporter.setMappings(mappings);
    mappings.put("001", "_id");
   
    mappings.put("010 $a", "xbib://identifierAuthorityLOC");
    //TODO: bei 016 ist auch die Quelle $2 eine wichtige Information
    mappings.put("016", "xbib://identifierAuthority");
    mappings.put("035 $a", "xbib://identifierAuthorityEKI");
    //TODO: combination of fields are relevant; code="0">(DE-588a) + code="4">aut< for PND-author
    mappings.put("100", "xbib:creatorDNBGND");
    mappings.put("245 $a", "dc:title");
    mappings.put("502 $o", "xbib://identifierUniversityScript");
   
    marcImporter.setPrimaryIdTemplate("urn:nbn:de:eki:cg$ID");
    HashMapPropertyRecordDao dao = new HashMapPropertyRecordDao();
    marcImporter.setPropertyRecordDao(dao);
    marcImporter.importMarcXmlFromFile(new File(
        "test/input/A2010titmrc_1.xml"));
    logger.info(dao);
    assertEquals(162, dao.size());
       
    PropertyRecord firstRecord = dao.get("urn:nbn:de:eki:cg010014055");
View Full Code Here

  }

  public void testImportMarcXml_MongoDB() throws IOException, CultureGraphException {
   
   
    MarcImporter marcImporter = new MarcImporter();
    HashMap<String, String> mappings = new HashMap<String, String>();
    marcImporter.setMappings(mappings);
    mappings.put("001", "_id");
   
    mappings.put("010 $a", "xbib://identifierAuthorityLOC");
    //TODO: bei 016 ist auch die Quelle $2 eine wichtige Information
    mappings.put("016", "xbib://identifierAuthority");
    mappings.put("035 $a", "xbib://identifierAuthorityEKI");
    //TODO: combination of fields are relevant; code="0">(DE-588a) + code="4">aut< for PND-author
    mappings.put("100", "xbib:creatorDNBGND");
    mappings.put("245 $a", "dc:title");
    mappings.put("502 $o", "xbib://identifierUniversityScript");
   
    //mappings.put("022 $a", "dc:identifier");
    //mappings.put("027 $a", "dc:identifier");     
    //mappings.put("245 $a", "title");
    MongoDao dao = MongoDao.Factory.newTestMongoDao();
    marcImporter.setPropertyRecordDao(dao);
    marcImporter.setPrimaryIdTemplate("urn:nbn:de:eki:cg$ID");
    marcImporter.importMarcXmlFromFile(new File("test/input/A2010titmrc_1.xml"));

  }
View Full Code Here

TOP

Related Classes of org.culturegraph.registry.importers.MarcImporter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.