001/* 002 * Copyright 2015 DuraSpace, Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.fcrepo.integration.rdf; 017 018import org.junit.Test; 019 020/** 021 * @author cabeer 022 */ 023public class ModsRdfIT extends AbstractIntegrationRdfIT { 024 @Test 025 public void testRoundtripModsRDF() { 026 // converted RDF-XML to TTL from 027 // https://raw.githubusercontent.com/blunalucero/MODS-RDF/master/Sample_record_Academic_Commons_MODS_RDF.rdf 028 // and fixed document URI and relative URI reference to use null-relative and hash uris 029 final String s = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n" + 030 "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" + 031 "@prefix identifier: <http://id.loc.gov/vocabulary/identifier/> .\n" + 032 "@prefix relator: <http://id.loc.gov/vocabulary/relator/> .\n" + 033 "@prefix note: <http://id.loc.gov/vocabulary/note/> .\n" + 034 "@prefix xs: <http://www.w3.org/2001/XMLSchema> .\n" + 035 "@prefix abstract: <http://id.loc.gov/vocabulary/abstract/> .\n" + 036 "@prefix access: <http://id.loc.gov/vocabulary/access/> .\n" + 037 "@prefix fo: <http://www.w3.org/1999/XSL/Format> .\n" + 038 "@prefix class: <http://id.loc.gov/vocabulary/class/> .\n" + 039 "@prefix fn: <http://www.w3.org/2005/xpath-functions> .\n" + 040 "@prefix mods: <http://www.loc.gov/mods/v3> .\n" + 041 "@prefix ri: <http://id.loc.gov/ontologies/RecordInfo#> .\n" + 042 "@prefix modsrdf: <http://www.loc.gov/mods/rdf/v1#> .\n" + 043 "@prefix madsrdf: <http://www.loc.gov/mads/rdf/v1#> .\n" + 044 "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n" + 045 "\n" + 046 "<>\n" + 047 " identifier:hdl \"http://hdl.handle.net/10022/AC:P:11905\" ;\n" + 048 " modsrdf:LanguageOfResource \"English\" ;\n" + 049 " modsrdf:abstract \"A mechanism had been recently proposed to show how an....\" ;\n" + 050 " modsrdf:administrativeMedatata [\n" + 051 " ri:languageOfCataloging \"eng\" ;\n" + 052 " ri:recordContentSource \"NNC\" ;\n" + 053 " ri:recordIdentifier \"5890\" ;\n" + 054 " ri:recordInfoRecordChangeDate \"2012-08-01 14:40:32 -0400\"^^<xsd:date> ;\n" + 055 " ri:recordInfoRecordCreationDate \"2011-12-06 10:27:50 -0500\"^^<xsd:date> ;\n" + 056 " a ri:AdministrativeMedatata\n" + 057 " ] ;\n" + 058 " modsrdf:genre [\n" + 059 " madsrdf:elementList ([\n" + 060 " madsrdf:elementValue \"Articles\" ;\n" + 061 " a madsrdf:GenreFormElement\n" + 062 " ]\n" + 063 " ) ;\n" + 064 " a madsrdf:GenreForm ;\n" + 065 " rdfs:label \"Articles\"\n" + 066 " ] ;\n" + 067 " modsrdf:locationOfResource [\n" + 068 " modsrdf:locationPhysicalLocation \"NNC\" ;\n" + 069 " a modsrdf:Location\n" + 070 " ] ;\n" + 071 " modsrdf:name <#d1e24>, <#d1e42>, <#d1e60>, <#d1e9> ;\n" + 072 " modsrdf:resourceDateIssued \"1992\"^^<xsd:date> ;\n" + 073 " modsrdf:roleRelationship [\n" + 074 " modsrdf:roleRelationshipName <#d1e24> ;\n" + 075 " modsrdf:roleRelationshipRole \"author\" ;\n" + 076 " a modsrdf:RoleRelationship\n" + 077 " ], [\n" + 078 " modsrdf:roleRelationshipName <#d1e42> ;\n" + 079 " modsrdf:roleRelationshipRole \"author\" ;\n" + 080 " a modsrdf:RoleRelationship\n" + 081 " ], [\n" + 082 " modsrdf:roleRelationshipName <#d1e60> ;\n" + 083 " modsrdf:roleRelationshipRole \"originator\" ;\n" + 084 " a modsrdf:RoleRelationship\n" + 085 " ], [\n" + 086 " modsrdf:roleRelationshipName <#d1e9> ;\n" + 087 " modsrdf:roleRelationshipRole \"author\" ;\n" + 088 " a modsrdf:RoleRelationship\n" + 089 " ] ;\n" + 090 " modsrdf:subjectComplex [\n" + 091 " madsrdf:componentList ([\n" + 092 " madsrdf:elementList ([\n" + 093 " madsrdf:elementValue \"Geophysics\" ;\n" + 094 " a madsrdf:TopicElement\n" + 095 " ]\n" + 096 " ) ;\n" + 097 " a madsrdf:Topic ;\n" + 098 " rdfs:label \"Geophysics\"\n" + 099 " ]\n" + 100 " ) ;\n" + 101 " a madsrdf:ComplexSubject ;\n" + 102 " rdfs:label \"Geophysics. \"\n" + 103 " ] ;\n" + 104 " modsrdf:titlePrincipal [\n" + 105 " madsrdf:elementList ([\n" + 106 " madsrdf:elementValue \"A detailed chronology of the Australasian impact event, " + 107 "the Brunhes-Matuyama geomagnetic polarity reversal, and global climate change\" ;\n" + 108 " a madsrdf:mainTitleElement\n" + 109 " ]\n" + 110 " ) ;\n" + 111 " a madsrdf:Title ;\n" + 112 " rdfs:label \"A detailed chronology of the Australasian impact event, the Brunhes-Matuyama " + 113 "geomagnetic polarity reversal, and global climate change\"\n" + 114 " ] ;\n" + 115 " a <http://id.loc.gov/vocabulary/resourceType#Text>, modsrdf:ModsResource .\n" + 116 "\n" + 117 "<#d1e24>\n" + 118 " madsrdf:elementList ([\n" + 119 " madsrdf:elementValue \"Kent\" ;\n" + 120 " a madsrdf:FamilyNameElement\n" + 121 " ]\n" + 122 " [\n" + 123 " madsrdf:elementValue \"Dennis V.\" ;\n" + 124 " a madsrdf:GivenNameElement\n" + 125 " ]\n" + 126 " ) ;\n" + 127 " a madsrdf:PersonalName ;\n" + 128 " rdfs:label \" Dennis V. Kent \" .\n" + 129 "\n" + 130 "<#d1e42>\n" + 131 " madsrdf:elementList ([\n" + 132 " madsrdf:elementValue \"Mello\" ;\n" + 133 " a madsrdf:FamilyNameElement\n" + 134 " ]\n" + 135 " [\n" + 136 " madsrdf:elementValue \"Gilberto A.\" ;\n" + 137 " a madsrdf:GivenNameElement\n" + 138 " ]\n" + 139 " ) ;\n" + 140 " a madsrdf:PersonalName ;\n" + 141 " rdfs:label \" Gilberto A. Mello \" .\n" + 142 "\n" + 143 "<#d1e60>\n" + 144 " madsrdf:elementList ([\n" + 145 " madsrdf:elementValue \"Columbia University. Lamont-Doherty Earth Observatory\" ;\n" + 146 " a madsrdf:FullNameElement\n" + 147 " ]\n" + 148 " ) ;\n" + 149 " a madsrdf:CorporateName ;\n" + 150 " rdfs:label \"Columbia University. Lamont-Doherty Earth Observatory\" .\n" + 151 "\n" + 152 "<#d1e9>\n" + 153 " madsrdf:elementList ([\n" + 154 " madsrdf:elementValue \"Schneider\" ;\n" + 155 " a madsrdf:FamilyNameElement\n" + 156 " ]\n" + 157 " [\n" + 158 " madsrdf:elementValue \"David A.\" ;\n" + 159 " a madsrdf:GivenNameElement\n" + 160 " ]\n" + 161 " ) ;\n" + 162 " a madsrdf:PersonalName ;\n" + 163 " rdfs:label \" David A. Schneider \" ."; 164 165 createLDPRSAndCheckResponse(getRandomUniqueId(), s); 166 } 167}