Search in sources :

Example 21 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeTableFormatTest method testCitation.

/**
 * Tests the formatting of a {@link DefaultCitation} object.
 *
 * @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
 */
@Test
public void testCitation() {
    final DefaultCitation citation = DefaultCitationTest.create();
    final String text = format.format(citation.asTreeTable());
    assertMultilinesEquals("Citation……………………………………………………………………………… Undercurrent\n" + "  ├─Alternate title………………………………………………… Andākarento\n" + "  ├─Identifier……………………………………………………………… 9782505004509\n" + "  │   └─Authority……………………………………………………… International Standard Book Number\n" + "  │       └─Alternate title…………………………… ISBN\n" + "  ├─Cited responsible party (1 of 2)\n" + "  │   ├─Role…………………………………………………………………… Author\n" + "  │   └─Party………………………………………………………………… Testsuya Toyoda\n" + "  ├─Cited responsible party (2 of 2)\n" + "  │   ├─Role…………………………………………………………………… EDITOR\n" + "  │   ├─Extent……………………………………………………………… World\n" + "  │   │   └─Geographic element\n" + "  │   │       ├─West bound longitude…… 180°W\n" + "  │   │       ├─East bound longitude…… 180°E\n" + "  │   │       ├─South bound latitude…… 90°S\n" + "  │   │       ├─North bound latitude…… 90°N\n" + "  │   │       └─Extent type code……………… true\n" + "  │   └─Party………………………………………………………………… Kōdansha\n" + "  ├─Presentation form (1 of 2)…………………… Document digital\n" + "  ├─Presentation form (2 of 2)…………………… Document hardcopy\n" + "  └─ISBN……………………………………………………………………………… 9782505004509\n", text);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test) DefaultCitationTest(org.apache.sis.metadata.iso.citation.DefaultCitationTest)

Example 22 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class TreeTableFormatTest method testTreeWithCustomElements.

/**
 * Tests the formatting of a {@link DefaultDataIdentification} object with custom code list elements
 */
@Test
public void testTreeWithCustomElements() {
    final DefaultCitation citation = new DefaultCitation();
    citation.setAlternateTitles(Arrays.asList(new SimpleInternationalString("Apple"), new SimpleInternationalString("Orange"), new SimpleInternationalString("Kiwi")));
    citation.setPresentationForms(Arrays.asList(PresentationForm.IMAGE_DIGITAL, // Existing form
    PresentationForm.valueOf("AUDIO_DIGITAL"), // Custom form
    PresentationForm.valueOf("test")));
    final String text = format.format(citation.asTreeTable());
    assertMultilinesEquals("Citation\n" + "  ├─Alternate title (1 of 3)………… Apple\n" + "  ├─Alternate title (2 of 3)………… Orange\n" + "  ├─Alternate title (3 of 3)………… Kiwi\n" + "  ├─Presentation form (1 of 3)…… Image digital\n" + // Missing localization resource for that one.
    "  ├─Presentation form (2 of 3)…… AUDIO-DIGITAL\n" + "  └─Presentation form (3 of 3)…… Test\n", text);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test) DefaultCitationTest(org.apache.sis.metadata.iso.citation.DefaultCitationTest)

Example 23 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class DefaultIdentifierTest method testMarshal.

/**
 * Tests XML marshalling.
 *
 * @throws JAXBException if an error occurred during (un)marshalling.
 */
@Test
public void testMarshal() throws JAXBException {
    final DefaultIdentifier identifier = new DefaultIdentifier();
    identifier.setAuthority(new DefaultCitation("EPSG"));
    identifier.setCode("4326");
    assertXmlEquals(XML, marshal(identifier), "xmlns:*");
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation)

Example 24 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class DefaultDataIdentificationTest method create.

/**
 * Creates the instance to test.
 */
private static DefaultDataIdentification create() {
    /*
         * Citation
         *   ├─Title……………………………………………………………………………… Sea Surface Temperature Analysis Model
         *   ├─Date
         *   │   ├─Date……………………………………………………………………… Sep 22, 2005 00:00:00 AM
         *   │   └─Date type………………………………………………………… Creation
         *   └─Identifier
         *       └─Code……………………………………………………………………… NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc
         */
    final DefaultCitation citation = new DefaultCitation("Sea Surface Temperature Analysis Model");
    citation.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2005-09-22 00:00:00"), DateType.CREATION)));
    citation.setIdentifiers(singleton(new DefaultIdentifier("SST_Global.nc")));
    /*
         * Descriptive keywords
         *   ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
         *   ├─Type………………………………………………………………………………… Theme
         *   └─Thesaurus name
         *       └─Title…………………………………………………………………… GCMD Science Keywords
         */
    final DefaultKeywords keywords = new DefaultKeywords("EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature");
    keywords.setType(KeywordType.THEME);
    keywords.setThesaurusName(new DefaultCitation("GCMD Science Keywords"));
    /*
         * Identification info
         *  ├─(above objects)
         *  ├─Abstract………………………………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data
         *  ├─Descriptive keywords
         *  │   ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
         *  │   ├─Type………………………………………………………………………………… Theme
         *  │   └─Thesaurus name
         *  │       └─Title…………………………………………………………………… GCMD Science Keywords
         *  ├─Resource constraints
         *  │   └─Use limitation……………………………………………………… Freely available
         *  ├─Spatial representation type……………………………… Grid
         *  ├─Language (1 of 2)………………………………………………………… en_US
         *  ├─Language (2 of 2)………………………………………………………… en
         *  ├─Character set…………………………………………………………………… US-ASCII
         *  └─Extent
         *      └─Geographic element
         *          ├─West bound longitude…………………………… 180°W
         *          ├─East bound longitude…………………………… 180°E
         *          ├─South bound latitude…………………………… 90°S
         *          ├─North bound latitude…………………………… 90°N
         *          └─Extent type code……………………………………… true
         */
    final DefaultDataIdentification info = new DefaultDataIdentification(citation, "NCEP SST Global 5.0 x 2.5 degree model data", null, null);
    info.setSpatialRepresentationTypes(singleton(SpatialRepresentationType.GRID));
    info.setDescriptiveKeywords(singleton(keywords));
    info.setResourceConstraints(singleton(new DefaultConstraints("Freely available")));
    info.setExtents(singleton(Extents.WORLD));
    info.setLanguages(asList(LOCALES));
    info.setCharacterSets(singleton(CharacterSet.US_ASCII));
    return info;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) DefaultIdentifier(org.apache.sis.metadata.iso.DefaultIdentifier) DefaultConstraints(org.apache.sis.metadata.iso.constraint.DefaultConstraints) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate)

Example 25 with DefaultCitation

use of org.apache.sis.metadata.iso.citation.DefaultCitation in project sis by apache.

the class DefaultOperationMethodTest method create.

/**
 * Creates a new two-dimensional operation method for an operation of the given name and identifier.
 *
 * @param  method      the operation name (example: "Mercator (variant A)").
 * @param  identifier  the EPSG numeric identifier (example: "9804").
 * @param  formula     formula citation (example: "EPSG guidance note #7-2").
 * @param  dimension   the number of input and output dimension, or {@code null}.
 * @param  parameters  the parameters (can be empty).
 * @return the operation method.
 */
static DefaultOperationMethod create(final String method, final String identifier, final String formula, final Integer dimension, final ParameterDescriptor<?>... parameters) {
    final Map<String, Object> properties = new HashMap<>(8);
    assertNull(properties.put(OperationMethod.NAME_KEY, method));
    assertNull(properties.put(ReferenceIdentifier.CODESPACE_KEY, "EPSG"));
    assertNull(properties.put(Identifier.AUTHORITY_KEY, Citations.EPSG));
    /*
         * The parameter group for a Mercator projection is actually not empty, but it is not the purpose of
         * this class to test DefaultParameterDescriptorGroup. So we use an empty group of parameters here.
         */
    final ParameterDescriptorGroup pg = new DefaultParameterDescriptorGroup(properties, 1, 1, parameters);
    /*
         * NAME_KEY share the same Identifier instance for saving a little bit of memory.
         * Then define the other properties to be given to OperationMethod.
         */
    assertNotNull(properties.put(OperationMethod.NAME_KEY, pg.getName()));
    assertNull(properties.put(OperationMethod.IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.EPSG, "EPSG", identifier)));
    assertNull(properties.put(OperationMethod.FORMULA_KEY, new DefaultCitation(formula)));
    return new DefaultOperationMethod(properties, dimension, dimension, pg);
}
Also used : DefaultParameterDescriptorGroup(org.apache.sis.parameter.DefaultParameterDescriptorGroup) HashMap(java.util.HashMap) DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) DefaultParameterDescriptorGroup(org.apache.sis.parameter.DefaultParameterDescriptorGroup) ParameterDescriptorGroup(org.opengis.parameter.ParameterDescriptorGroup) ImmutableIdentifier(org.apache.sis.metadata.iso.ImmutableIdentifier)

Aggregations

DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)65 Test (org.junit.Test)35 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)32 DependsOnMethod (org.apache.sis.test.DependsOnMethod)21 InternationalString (org.opengis.util.InternationalString)14 Citation (org.opengis.metadata.citation.Citation)10 IdentifiedObject (org.opengis.referencing.IdentifiedObject)9 ImmutableIdentifier (org.apache.sis.metadata.iso.ImmutableIdentifier)5 DefaultResponsibleParty (org.apache.sis.metadata.iso.citation.DefaultResponsibleParty)5 URI (java.net.URI)3 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)3 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)3 DefaultCitationTest (org.apache.sis.metadata.iso.citation.DefaultCitationTest)3 DefaultOnlineResource (org.apache.sis.metadata.iso.citation.DefaultOnlineResource)3 ArrayList (java.util.ArrayList)2 CI_Citation (org.apache.sis.internal.jaxb.metadata.CI_Citation)2 SimpleIdentifiedObject (org.apache.sis.internal.simple.SimpleIdentifiedObject)2 SimpleIdentifier (org.apache.sis.internal.simple.SimpleIdentifier)2 DefaultCitationDate (org.apache.sis.metadata.iso.citation.DefaultCitationDate)2 DefaultIndividual (org.apache.sis.metadata.iso.citation.DefaultIndividual)2