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