001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2006-2012 Open Geospatial Consortium, Inc.
006 * All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007 *
008 * Permission to use, copy, and modify this software and its documentation, with
009 * or without modification, for any purpose and without fee or royalty is hereby
010 * granted, provided that you include the following on ALL copies of the software
011 * and documentation or portions thereof, including modifications, that you make:
012 *
013 * 1. The full text of this NOTICE in a location viewable to users of the
014 * redistributed or derivative work.
015 * 2. Notice of any changes or modifications to the OGC files, including the
016 * date changes were made.
017 *
018 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019 * NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020 * TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021 * THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023 *
024 * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025 * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026 *
027 * The name and trademarks of copyright holders may NOT be used in advertising or
028 * publicity pertaining to the software without specific, written prior permission.
029 * Title to copyright in this software and any associated documentation will at all
030 * times remain with copyright holders.
031 */
032 package org.opengis.feature.type;
033
034 import java.util.Map;
035 import java.util.Set;
036
037 /**
038 * A collection of AttributeType.
039 * <p>
040 * A schema is organized as a map of {@link Name} to {@link AttributeType}. In
041 * each name,type tuple, the name matches the name of the type.
042 * <pre>
043 * //create some attribute types
044 * AttributeType pointType =
045 * new AttributeTypeImpl( new NameImpl( "http://www.opengis.net/gml", "PointType" ), ... );
046 * AttributeType lineStringType =
047 * new AttributeTypeImpl( new NameImpl( "http://www.opengis.net/gml", "LineStringType" ), ... );
048 * AttributeType polygonType =
049 * new AttributeTypeImpl( new NameImpl( "http://www.opengis.net/gml", "PolygonType" ), ... );
050 *
051 * //create a schema
052 * Schema schema = new SchemaImpl( "http://www.opengis.net/gml" );
053 *
054 * //add types to the schema
055 * schema.add( pointType );
056 * schema.add( lineStringType );
057 * schema.add( polygonType );
058 * </pre>
059 * </p>
060 * <p>
061 * The intention of a schema is to provide a resuable set of attribute types.
062 * These types are used when building attribute instances.
063 * </p>
064 *
065 * @author Jody Garnett, Refractions Research, Inc.
066 * @author Justin Deoliveira, The Open Planning Project
067 */
068 public interface Schema extends Map<Name, AttributeType> {
069
070 /**
071 * The uri of the schema.
072 * <p>
073 * This method is a convenience for <code>keySet().getURI()</code>.
074 * </p>
075 *
076 * @return The uri of the schema.
077 */
078 String getURI();
079
080 /**
081 * Adds a type to the schema.
082 * <p>
083 * This method is a convenience for <code>put(type.getName(),type)</code>.
084 * </p>
085 * @param type The type to add.
086 */
087 void add( AttributeType type );
088
089 /**
090 * Profiles the schema, creating a new schema in the process.
091 * <p>
092 * A profile of a schema is a subset of the schema, and it also a schema
093 * itself.
094 * </p>
095 * <p>
096 * Used to select a subset of types for a specific application. Profiles
097 * often are used to express limitiations of a source of data.
098 * </p>
099 * @param profile The set of names which corresond to entries that will make
100 * up the profile.
101 *
102 * @return The profile of the original schema.
103 */
104 Schema profile( Set<Name> profile );
105 }