| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>FeatureSet (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.storage, package: org.apache.sis.storage, interface: FeatureSet"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.storage.FeatureSet interface"> |
| <meta name="keywords" content="getType()"> |
| <meta name="keywords" content="subset()"> |
| <meta name="keywords" content="features()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li>Nested</li> |
| <li>Field</li> |
| <li>Constr</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li>Field</li> |
| <li>Constr</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">org.apache.sis.storage</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.storage</a></div> |
| <h1 title="Interface FeatureSet" class="title">Interface FeatureSet</h1> |
| </div> |
| <section class="class-description" id="class-description"> |
| <dl class="notes"> |
| <dt>All Superinterfaces:</dt> |
| <dd><code><a href="DataSet.html" title="interface in org.apache.sis.storage">DataSet</a></code>, <code><a href="Resource.html" title="interface in org.apache.sis.storage">Resource</a></code></dd> |
| </dl> |
| <dl class="notes"> |
| <dt>All Known Subinterfaces:</dt> |
| <dd><code><a href="WritableFeatureSet.html" title="interface in org.apache.sis.storage">WritableFeatureSet</a></code></dd> |
| </dl> |
| <dl class="notes"> |
| <dt>All Known Implementing Classes:</dt> |
| <dd><code><a href="AbstractFeatureSet.html" title="class in org.apache.sis.storage">AbstractFeatureSet</a></code>, <code><a href="aggregate/ConcatenatedFeatureSet.html" title="class in org.apache.sis.storage.aggregate">ConcatenatedFeatureSet</a></code>, <code><a href="aggregate/JoinFeatureSet.html" title="class in org.apache.sis.storage.aggregate">JoinFeatureSet</a></code></dd> |
| </dl> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">FeatureSet</span><span class="extends-implements"> |
| extends <a href="DataSet.html" title="interface in org.apache.sis.storage">DataSet</a></span></div> |
| <div class="block">A dataset providing access to a stream of features. |
| All features share a common set of properties described by <a href="#getType()"><code>getType()</code></a>. |
| The common set of properties does not need to enumerate all possible properties since additional properties |
| can be defined in subtypes. In many cases at least one property is a geometry, but features without geometry |
| are also allowed.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.8</dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button><button id="method-summary-table-tab5" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab5', 3)" class="table-tab">Default Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Stream.html" title="class or interface in java.util.stream" class="external-link">Stream</a><wbr><<a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/AbstractFeature.html" title="class in org.apache.sis.feature">AbstractFeature</a>></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#features(boolean)" class="member-name-link">features</a><wbr>(boolean parallel)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Returns a stream of all features contained in this dataset.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">DefaultFeatureType</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getType()" class="member-name-link">getType</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Returns a description of properties that are common to all features in this dataset.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"><code>default <a href="FeatureSet.html" title="interface in org.apache.sis.storage">FeatureSet</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"><code><a href="#subset(org.apache.sis.storage.Query)" class="member-name-link">subset</a><wbr>(<a href="Query.html" title="class in org.apache.sis.storage">Query</a> query)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab5"> |
| <div class="block">Requests a subset of features and/or feature properties from this resource.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-DataSet">Methods inherited from interface <a href="DataSet.html" title="interface in org.apache.sis.storage">DataSet</a></h3> |
| <code><a href="DataSet.html#getEnvelope()">getEnvelope</a></code></div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Resource">Methods inherited from interface <a href="Resource.html" title="interface in org.apache.sis.storage">Resource</a></h3> |
| <code><a href="Resource.html#addListener(java.lang.Class,org.apache.sis.storage.event.StoreListener)">addListener</a>, <a href="Resource.html#getIdentifier()">getIdentifier</a>, <a href="Resource.html#getMetadata()">getMetadata</a>, <a href="Resource.html#removeListener(java.lang.Class,org.apache.sis.storage.event.StoreListener)">removeListener</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="getType()"> |
| <h3>getType</h3> |
| <div class="member-signature"><span class="return-type"><a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">DefaultFeatureType</a></span> <span class="element-name">getType</span>() |
| throws <span class="exceptions"><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div> |
| <div class="block">Returns a description of properties that are common to all features in this dataset. |
| The feature type contains the definition of all properties, including but not only: |
| <ul> |
| <li>Name to use for accessing the property</li> |
| <li>Human-readable description</li> |
| <li>Type of values</li> |
| <li>Multiplicity (minimum and maximum number of occurrences)</li> |
| <li><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/crs/CoordinateReferenceSystem.html" title="class or interface in org.opengis.referencing.crs" class="external-link">Coordinate Reference System</a>.</li> |
| </ul> |
| |
| All features returned by <a href="#features(boolean)"><code>features(boolean)</code></a> will be either of that type, or a sub-type of it. |
| |
| <h4 id="relationship-with-metadata-heading">Relationship with metadata</h4> |
| if subtypes exist, their list may be obtained from the <a href="Resource.html#getMetadata()">metadata</a> like below |
| (if the <code>FeatureSet</code> implementation provides that information): |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">for (ContentInformation content : metadata.getContentInfo()) { |
| if (content instanceof FeatureCatalogueDescription) { |
| for (FeatureTypeInfo info : ((FeatureCatalogueDescription) content).getFeatureTypeInfo()) { |
| GenericName name = info.getFeatureTypeName(); |
| // ... add the name to some list ... |
| } |
| } |
| } |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>description of common properties (never <code>null</code>).</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></code> - if an error occurred while reading definitions from the underlying data store.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="subset(org.apache.sis.storage.Query)"> |
| <h3>subset</h3> |
| <div class="member-signature"><span class="modifiers">default</span> <span class="return-type"><a href="FeatureSet.html" title="interface in org.apache.sis.storage">FeatureSet</a></span> <span class="element-name">subset</span><wbr><span class="parameters">(<a href="Query.html" title="class in org.apache.sis.storage">Query</a> query)</span> |
| throws <span class="exceptions"><a href="UnsupportedQueryException.html" title="class in org.apache.sis.storage">UnsupportedQueryException</a>, |
| <a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div> |
| <div class="block">Requests a subset of features and/or feature properties from this resource. |
| The filtering can be applied in two domains: |
| |
| <ul> |
| <li>The returned <code>FeatureSet</code> may contain a smaller number of <code>Feature</code> instances.</li> |
| <li>In each <code>Feature</code> instance of the returned set, the number of |
| <a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/DefaultFeatureType.html#getProperty(java.lang.String)">properties</a> may be smaller.</li> |
| </ul> |
| |
| While it is technically possible to return a <em>transformed</em> feature set (i.e. containing feature |
| properties not found in this original <code>FeatureSet</code>, for example as a result of some computation), |
| such usages should be rare. Transformations should be the topic of a separated processing package. |
| This <code>subset(Query)</code> method is rather for allowing <a href="DataStore.html" title="class in org.apache.sis.storage"><code>DataStore</code></a> implementations to optimize |
| the overall filtering by using the tools available with their format (for example an R-tree). |
| <code>BoundingBox</code> filters are the most common case of optimization implemented by <a href="DataStore.html" title="class in org.apache.sis.storage"><code>DataStore</code></a>. |
| |
| <p>The returned subset may be a <em>view</em> of this set, i.e. changes in this <code>FeatureSet</code> |
| may be reflected immediately on the returned subset (and conversely), but not necessarily. |
| However, the returned subset may not have the same capabilities as this <a href="FeatureSet.html" title="interface in org.apache.sis.storage"><code>FeatureSet</code></a>. |
| In particular, write operations may become unsupported after complex queries.</p> |
| |
| <h4 id="default-implementation-heading">Default implementation</h4> |
| The default implementation delegates to <a href="FeatureQuery.html#execute(org.apache.sis.storage.FeatureSet)"><code>FeatureQuery.execute(FeatureSet)</code></a> if the given query |
| is an instance of <code>FeatureQuery</code>, or throws <a href="UnsupportedQueryException.html" title="class in org.apache.sis.storage"><code>UnsupportedQueryException</code></a> otherwise. |
| The default <code>FeatureQuery</code> implementation tries to execute the query |
| by filtering the <a href="#features(boolean)">stream of features</a>, |
| which may be inefficient — subclasses are encouraged to override this <code>subset(Query)</code> method.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>query</code> - definition of feature and feature properties filtering applied at reading time.</dd> |
| <dt>Returns:</dt> |
| <dd>resulting subset of features (never <code>null</code>).</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="UnsupportedQueryException.html" title="class in org.apache.sis.storage">UnsupportedQueryException</a></code> - if this <code>FeatureSet</code> cannot execute the given query. |
| This includes query validation errors.</dd> |
| <dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></code> - if another error occurred while processing the query.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="GridCoverageResource.html#subset(org.apache.sis.storage.Query)"><code>GridCoverageResource.subset(CoverageQuerty)</code></a></li> |
| <li><a href="FeatureQuery.html#execute(org.apache.sis.storage.FeatureSet)"><code>FeatureQuery.execute(FeatureSet)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="features(boolean)"> |
| <h3>features</h3> |
| <div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Stream.html" title="class or interface in java.util.stream" class="external-link">Stream</a><<a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/AbstractFeature.html" title="class in org.apache.sis.feature">AbstractFeature</a>></span> <span class="element-name">features</span><wbr><span class="parameters">(boolean parallel)</span> |
| throws <span class="exceptions"><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></span></div> |
| <div class="block">Returns a stream of all features contained in this dataset. |
| For all features, the following condition shall be true: |
| |
| <blockquote><code><a href="#getType()">getType()</a>.<a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/DefaultFeatureType.html#isAssignableFrom(org.apache.sis.feature.DefaultFeatureType)">isAssignableFrom</a>(feature.<a href="../../../../../org.apache.sis.feature/org/apache/sis/feature/AbstractFeature.html#getType()">getType()</a>)</code></blockquote> |
| |
| Most implementations will create <code>Feature</code> instances on-the-fly when the stream terminal operation is executed. |
| A <code>try</code> … <code>finally</code> block should be used for releasing <a href="DataStore.html" title="class in org.apache.sis.storage"><code>DataStore</code></a> resources used by the operation. |
| If a checked exception happens during stream execution, that exception will be wrapped in an unchecked |
| <a href="../../../../../org.apache.sis.util/org/apache/sis/util/collection/BackingStoreException.html" title="class in org.apache.sis.util.collection"><code>BackingStoreException</code></a>. |
| The following code shows how this stream can be used: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java"> void myReadOperation() throws DataStoreException { |
| try (Stream<Feature> features = myDataStore.features(false)) { |
| // Use the stream here. |
| } catch (BackingStoreException e) { |
| throw e.unwrapOrRethrow(DataStoreException.class); |
| } |
| } |
| </code></pre> |
| </div> |
| |
| |
| The <code>parallel</code> argument specifies whether a parallelized stream is desired. If <code>false</code>, the stream |
| is guaranteed to be sequential. If <code>true</code>, the stream may or may not be parallel; implementations are free |
| to ignore this argument if they do not support parallelism.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>parallel</code> - <code>true</code> for a parallel stream (if supported), or <code>false</code> for a sequential stream.</dd> |
| <dt>Returns:</dt> |
| <dd>all features contained in this dataset.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="DataStoreException.html" title="class in org.apache.sis.storage">DataStoreException</a></code> - if an error occurred while creating the stream.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |