Example #1
0
		private string CreateCorpusCatalogue()
		{
			// Create the package catalogue imdi file
			var catalogue = new Catalogue
			{
				Name = Name + " Catalogue",
				Title = Title,
				Date = DateTime.Today.ToISO8601DateOnlyString(),
			};

			foreach (var language in MetadataIso3Languages)
			{
				var imdiLanguage = LanguageList.Find(language).ToSimpleLanguageType();
				if (imdiLanguage != null)
					catalogue.DocumentLanguages.Language.Add(imdiLanguage);
			}


			foreach (var language in ContentIso3Languages)
			{
				var imdiLanguage = LanguageList.Find(language).ToSubjectLanguageType();
				if (imdiLanguage != null)
					catalogue.SubjectLanguages.Language.Add(imdiLanguage);
			}

			// funding project
			if (FundingProject != null)
				catalogue.Project.Add(new Project(FundingProject));

			// location
			if (Location != null)
				catalogue.Location.Add(new LocationType(Location));

			// content type
			if (!string.IsNullOrEmpty(ContentType))
				catalogue.ContentType.Add(ContentType);

			// applications
			if (!string.IsNullOrEmpty(Applications))
				catalogue.Applications = Applications;

			// author
			if (!string.IsNullOrEmpty(Author))
				catalogue.Author.Add(new CommaSeparatedStringType { Value = Author });

			// publisher
			if (!string.IsNullOrEmpty(Publisher))
				catalogue.Publisher.Add(Publisher);

			// keys
			foreach (var kvp in _keys)
				catalogue.Keys.Key.Add(new KeyType { Name = kvp.Key, Value = kvp.Value });

			// access
			if (!string.IsNullOrEmpty(Access.DateAvailable))
				catalogue.Access.Date = Access.DateAvailable;

			if (!string.IsNullOrEmpty(Access.Owner))
				catalogue.Access.Owner = Access.Owner;

			// write the xml file
			var catImdi = new MetaTranscript { Items = new object[] { catalogue }, Type = MetatranscriptValueType.CATALOGUE };
			return catImdi.WriteImdiFile(_packagePath, Name).Replace("\\", "/");
		}
Example #2
0
		private void ArbilCheckCatalogue(Catalogue catalogue)
		{
			if (catalogue.Id.Count == 0)
				catalogue.Id.Add("");

			if (catalogue.Description.Count == 0)
				catalogue.Description.Add(new LanguageString());

			if (catalogue.Location.Count == 0)
				catalogue.Location.Add(new LocationType());

			if (catalogue.ContentType.Count == 0)
				catalogue.ContentType.Add(string.Empty);

			if (catalogue.Project.Count == 0)
				catalogue.Project.Add(new Project());

			if (catalogue.Publisher.Count == 0)
				catalogue.Publisher.Add(string.Empty);

			if (catalogue.Author.Count == 0)
				catalogue.Author.Add(new CommaSeparatedStringType());
		}