blob: 8f9b30d7ca699710d3b4bae711b0c1c21541c386 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (19) -->
<title>FeatureSet (Apache SIS 1.3 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="description" content="declaration: 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">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.6.0.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">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</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="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/FeatureSet.html">Use</a></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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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="package-label-in-type">Package</span>&nbsp;<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">Data­Set</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">Writable­Feature­Set</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">Abstract­Feature­Set</a></code>, <code><a href="aggregate/ConcatenatedFeatureSet.html" title="class in org.apache.sis.storage.aggregate">Concatenated­Feature­Set</a></code>, <code><a href="aggregate/JoinFeatureSet.html" title="class in org.apache.sis.storage.aggregate">Join­Feature­Set</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>get­Type()</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>
<p><font size="-1">Defined in the <code>sis-storage</code> module</font></p>
</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/16/docs/api/java.base/java/util/stream/Stream.html" title="class or interface in java.util.stream" class="external-link">Stream</a>&lt;<a href="../feature/AbstractFeature.html" title="class in org.apache.sis.feature">Abstract­Feature</a>&gt;</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&nbsp;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="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">Default­Feature­Type</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">get­Type</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">Feature­Set</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>&nbsp;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&nbsp;<a href="DataSet.html" title="interface in org.apache.sis.storage">DataSet</a></h3>
<code><a href="DataSet.html#getEnvelope()">get­Envelope</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Resource">Methods inherited from interface&nbsp;<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)">add­Listener</a>, <a href="Resource.html#getIdentifier()">get­Identifier</a>, <a href="Resource.html#getMetadata()">get­Metadata</a>, <a href="Resource.html#removeListener(java.lang.Class,org.apache.sis.storage.event.StoreListener)">remove­Listener</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="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">DefaultFeatureType</a></span>&nbsp;<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.
<div class="note"><b>Relationship with metadata:</b>
if subtypes exist, their list may be obtained from the <a href="Resource.html#getMetadata()">metadata</a> like below
(if the <code>Feature­Set</code> implementation provides that information):
<blockquote><pre><font color="green">for</font> (ContentInformation content : metadata.<b>getContentInfo</b>()) {
<font color="green">if</font> (content <font color="green">instanceof</font> FeatureCatalogueDescription) {
<font color="green">for</font> (FeatureTypeInfo info : ((FeatureCatalogueDescription) content).<b>getFeatureTypeInfo</b>()) {
GenericName name = info.<b>getFeatureTypeName</b>();
<i><font color="gray">// ... add the name to some list ...</font></i>
}
}
}</pre></blockquote>
</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">Data­Store­Exception</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>&nbsp;<span class="return-type"><a href="FeatureSet.html" title="interface in org.apache.sis.storage">FeatureSet</a></span>&nbsp;<span class="element-name">subset</span><wbr><span class="parameters">(<a href="Query.html" title="class in org.apache.sis.storage">Query</a>&nbsp;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>Feature­Set</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="../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>Feature­Set</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>Data­Store</code></a> implementations to optimize
the overall filtering by using the tools available with their format (for example an R-tree).
<code>Bounding­Box</code> filters are the most common case of optimization implemented by <a href="DataStore.html" title="class in org.apache.sis.storage"><code>Data­Store</code></a>.
<p>The returned subset may be a <em>view</em> of this set, i.e. changes in this <code>Feature­Set</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>Feature­Set</code></a>.
In particular, write operations may become unsupported after complex queries.</p>
<h4>Default implementation</h4>
The default implementation delegates to <a href="FeatureQuery.html#execute(org.apache.sis.storage.FeatureSet)"><code>Feature­Query​.execute(Feature­Set)</code></a> if the given query
is an instance of <code>Feature­Query</code>, or throws <a href="UnsupportedQueryException.html" title="class in org.apache.sis.storage"><code>Unsupported­Query­Exception</code></a> otherwise.
The default <code>Feature­Query</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">Unsupported­Query­Exception</a></code> - if this <code>Feature­Set</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">Data­Store­Exception</a></code> - if another error occurred while processing the query.</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list-long">
<li><a href="GridCoverageResource.html#subset(org.apache.sis.storage.Query)"><code>Grid­Coverage­Resource​.subset(Coverage­Querty)</code></a></li>
<li><a href="FeatureQuery.html#execute(org.apache.sis.storage.FeatureSet)"><code>Feature­Query​.execute(Feature­Set)</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/16/docs/api/java.base/java/util/stream/Stream.html" title="class or interface in java.util.stream" class="external-link">Stream</a>&lt;<a href="../feature/AbstractFeature.html" title="class in org.apache.sis.feature">AbstractFeature</a>&gt;</span>&nbsp;<span class="element-name">features</span><wbr><span class="parameters">(boolean&nbsp;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()">get­Type()</a>.<a href="../feature/DefaultFeatureType.html#isAssignableFrom(org.apache.sis.feature.DefaultFeatureType)">is­Assignable­From</a>(feature.<a href="../feature/AbstractFeature.html#getType()">get­Type()</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>Data­Store</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="../util/collection/BackingStoreException.html" title="class in org.apache.sis.util.collection"><code>Backing­Store­Exception</code></a>.
The following code shows how this stream can be used:
<blockquote><pre><font color="green">void</font> <b>myReadOperation</b>() <font color="green">throws</font> DataStoreException {
<font color="green">try</font> (Stream&lt;Feature&gt; features = myDataStore.<b>features</b>(<font color="green">false</font>)) {
<i><font color="gray">// Use the stream here.</font></i>
} <font color="green">catch</font> (BackingStoreException e) {
<font color="green">throw</font> e.<b>unwrapOrRethrow</b>(DataStoreException.<font color="green">class</font>);
}
}</pre></blockquote>
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">Data­Store­Exception</a></code> - if an error occurred while creating the stream.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2010&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>