A simple implementation of the UK Gemini 2.2 metadata standard.
예제 #1
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
        public XDocument Create(Guid id, Metadata m)
        {
            // see http://data.gov.uk/sites/default/files/UK%20GEMINI%20Encoding%20Guidance%201.4.pdf

            return new XDocument(
                new XElement(gmd + "MD_Metadata",
                    new XAttribute(XNamespace.Xmlns + "gmd", gmd.NamespaceName),
                    new XAttribute(XNamespace.Xmlns + "gco", gco.NamespaceName),
                    new XAttribute(XNamespace.Xmlns + "gml", gml.NamespaceName),
                    MakeFileIdentifier(id),
                    MakeDatasetLanguage(m), // continually confused with MetadataLanguage
                    MakeResourceType(m),
                    MakeMetadataPointOfContact(m),
                    MakeMetadataDate(m),
                    new XElement(gmd + "identificationInfo",
                        new XElement(gmd + "MD_DataIdentification",
                            new XAttribute("id", "_" + id),
                            new XElement(gmd + "citation",
                                new XElement(gmd + "CI_Citation",
                                    MakeTitle(m),
                                    MakeDatasetReferenceDate(m),
                                    MakeUniqueResourceIdentifier(id))),
                            MakeAbstract(m),
                            MakeResponsibleOrganisation(m),
                            MakeKeywords(m),
                            MakeLimitationsOnPublicAccessAndUseConstraints(m), // think ienum will actually work
                            MakeDatasetLanguage(m),
                            MakeTopicCategory(m),
                            new XElement(gmd + "extent",
                                new XElement(gmd + "EX_Extent",
                                    MakeBoundingBox(m),
                                    MakeTemporalExtent(m))))),
                    new XElement(gmd + "distributionInfo",
                        new XElement(gmd + "MD_Distribution",
                            MakeDataFormat(m),
                            MakeResourceLocator(m, id))),
                    MakeLineage(m)));
        }
예제 #2
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeTitle(Metadata metadata)
 {
     return new XElement(gmd + "title",
         new XElement(gco + "CharacterString", metadata.Title));
 }
예제 #3
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeTemporalExtent(Metadata metadata)
 {
     return new XElement(gmd + "temporalElement",
         new XElement(gmd + "EX_TemporalExtent",
             new XElement(gmd + "extent",
                 new XElement(gml + "TimePeriod",
                     new XAttribute(gml + "id", "t1"),
                     new XElement(gml + "beginPosition", metadata.TemporalExtent.Begin),
                     new XElement(gml + "endPosition", metadata.TemporalExtent.End)))));
 }
예제 #4
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeResponsibleOrganisation(Metadata metadata)
 {
     return new XElement(gmd + "pointOfContact",
         Shared.MakeResponsiblePartyNode(metadata.ResponsibleOrganisation));
 }
예제 #5
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeResourceType(Metadata metadata)
 {
     return new XElement(gmd + "hierarchyLevel",
         new XElement(gmd + "MD_ScopeCode",
             new XAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#MD_ScopeCode"),
             new XAttribute("codeListValue", metadata.ResourceType),
                 metadata.ResourceType));
 }
예제 #6
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
        XElement MakeResourceLocator(Metadata metadata, Guid id)
        {
            string fileName = WebificationUtility.ToUrlFriendlyString(Path.GetFileName(metadata.ResourceLocator));
            // but this doesn't work so well when the resource locator contains the guid like this
            // http://data.jncc.gov.uk/data/d4ddd363-97eb-4ef6-9b8b-6f019f434103-ProcessedImages.zip
            // so remove the proceeding guid
            if (fileName.IsNotBlank() && fileName.StartsWith(id + "-"))
                fileName = fileName.Replace(id + "-", String.Empty);

            return new XElement(gmd + "transferOptions",
                new XElement(gmd + "MD_DigitalTransferOptions",
                    new XElement(gmd + "onLine",
                        new XElement(gmd + "CI_OnlineResource",
                            new XElement(gmd + "linkage",
                                new XElement(gmd + "URL", metadata.ResourceLocator)),
                            new XElement(gmd + "name",
                                new XElement(gco + "CharacterString", fileName))))));
        }
예제 #7
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeMetadataPointOfContact(Metadata metadata)
 {
     return new XElement(gmd + "contact",
         Shared.MakeResponsiblePartyNode(metadata.MetadataPointOfContact));
 }
예제 #8
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeBoundingBox(Metadata metadata)
 {
     if (metadata.BoundingBox == null)
     {
         return null;
     }
     return new XElement(gmd + "geographicElement",
         new XElement(gmd + "EX_GeographicBoundingBox",
             new XElement(gmd + "westBoundLongitude",
                 new XElement(gco + "Decimal", metadata.BoundingBox.West)),
             new XElement(gmd + "eastBoundLongitude",
                 new XElement(gco + "Decimal", metadata.BoundingBox.East)),
             new XElement(gmd + "southBoundLatitude",
                 new XElement(gco + "Decimal", metadata.BoundingBox.South)),
             new XElement(gmd + "northBoundLatitude",
                 new XElement(gco + "Decimal", metadata.BoundingBox.North))));
 }
예제 #9
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeLineage(Metadata metadata)
 {
     return new XElement(gmd + "dataQualityInfo",
         new XElement(gmd + "DQ_DataQuality",
             new XElement(gmd + "scope",
                 new XElement(gmd + "DQ_Scope",
                     new XElement(gmd + "level",
                         new XElement(gmd + "MD_ScopeCode",
                             new XAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#MD_ScopeCode"),
                             new XAttribute("codeListValue", "dataset"))))),
             new XElement(gmd + "lineage",
                 new XElement(gmd + "LI_Lineage",
                     new XElement(gmd + "statement",
                         new XElement(gco + "CharacterString", metadata.Lineage))))));
 }
예제 #10
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeLimitationsOnPublicAccessAndUseConstraints(Metadata metadata)
 {
     return new XElement(gmd + "resourceConstraints",
         new XElement(gmd + "MD_LegalConstraints",
             new XElement(gmd + "useLimitation",
                 new XElement(gco + "CharacterString", metadata.UseConstraints)),
             new XElement(gmd + "accessConstraints",
                 new XElement(gmd + "MD_RestrictionCode",
                     new XAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#MD_RestrictionCode"),
                     new XAttribute("codeListValue", "otherRestrictions"),
                     "otherRestrictions")),
             new XElement(gmd + "otherConstraints",
                 new XElement(gco + "CharacterString", metadata.LimitationsOnPublicAccess))
             ));
 }
예제 #11
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
        XElement MakeKeywords(Metadata metadata)
        {
            return new XElement(gmd + "descriptiveKeywords",
                new XElement(gmd + "MD_Keywords",
                    from keyword in metadata.Keywords
                    select new XElement(gmd + "keyword",
                        new XElement(gco + "CharacterString", keyword.Value))));

            // String vocab = metadata.Keywords.FirstOrDefault().Vocab;
            // a half implemented attempt to encode the vocab along with keywords
                        /*, new XElement(gmd + "thesaurusName",
                new XElement(gmd + "CI_Citation",
                    new XElement(gmd + "title",
                        new XElement(gco + "CharacterString", vocab)),
                        new XElement(gmd+"date",
                            new XElement(gmd+"CI_Date",
                                new XElement(gmd+"date",
                                    new XElement(gco + "Date", metadata.DatasetReferenceDate)),
                                    new XElement(gmd+"dateType",
                                        new XElement(gmd + "CI_DateTypeCode",
                            new XAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#CI_DateTypeCode"),
                            new XAttribute("codeListValue", "publication")))))))));*/

            // writing massiviely nested iso compatible xml documents by hand, bleurgh
        }
예제 #12
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeDatasetReferenceDate(Metadata metadata)
 {
     return new XElement(gmd + "date",
         new XElement(gmd + "CI_Date",
             new XElement(gmd + "date",
                 new XElement(gco + "Date", metadata.DatasetReferenceDate)),
             new XElement(gmd + "dateType",
                 new XElement(gmd + "CI_DateTypeCode",
                     new XAttribute("codeList", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/gmxCodelists.xml#CI_DateTypeCode"),
                     new XAttribute("codeListValue", "publication"),
                     metadata.DatasetReferenceDate))));
 }
예제 #13
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
        XElement MakeDatasetLanguage(Metadata metadata)
        {
            // this is required unfortunately by ISO19115 but not Gemini - default to eng

            return new XElement(gmd + "language",
                new XElement(gmd + "LanguageCode",
                    new XAttribute("codeList", "http://www.loc.gov/standards/iso639-2/php/code_list.php"),
                    new XAttribute("codeListValue", "eng"),
                    "eng"));
        }
예제 #14
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeDataFormat(Metadata metadata)
 {
     return new XElement(gmd + "distributionFormat",
         new XElement(gmd + "MD_Format",
             new XElement(gmd + "name",
                 new XElement(gco + "CharacterString", metadata.DataFormat)),
             new XElement(gmd + "version",
                 new XElement(gco + "CharacterString", "Unknown"))));
     // not supporting versions for data format
 }
예제 #15
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeTopicCategory(Metadata metadata)
 {
     return new XElement(gmd + "topicCategory",
         new XElement(gmd + "MD_TopicCategoryCode", metadata.TopicCategory));
 }
예제 #16
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeMetadataDate(Metadata metadata)
 {
     return new XElement(gmd + "dateStamp",
         new XElement(gco + "Date", metadata.MetadataDate.ToString("yyyy-MM-dd")));
 }
예제 #17
0
파일: XmlEncoder.cs 프로젝트: jncc/topcat
 XElement MakeAbstract(Metadata metadata)
 {
     return new XElement(gmd + "abstract",
         new XElement(gco + "CharacterString", metadata.Abstract));
 }