Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: support for range-based matching #16

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,64 @@ <h3><dfn>Source</dfn> interface</h3>
</p>
</section>

<section data-dfn-for="Range">
<h3><dfn>Range</dfn> interface</h3>
<pre class="idl">
interface Range {
attribute gt? Term;
attribute gte? Term;
attribute lt? Term;
attribute lte? Term;
};
</pre>
<p>
A Range is an object that defines a gamut of values by declaring the
gamut's own inclusive or exclusive boundaries.
</p>
</section>

<section data-dfn-for="RangeSource">
<h3><dfn>RangeSource</dfn> interface</h3>
<pre class="idl">
[Constructor,
Constructor(ConstructorOptions options)]
interface RangeSource {
Stream&lt;Quad&gt; match(
optional Term|Range[]|Range? subject,
optional Term|Range[]|Range? predicate,
optional Term|Range[]|Range? object,
optional Term|Range[]|Range? graph
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When one would use Range at any other position in the quad than object ? I think it should only apply to Literals which only can appear on object position.

Copy link
Author

@jacoscaz jacoscaz Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never had to do it myself but I've seen prefix-based queries targeting subject and graph named nodes a few times.

Added for clarity: a prefix-based query is a special case of a range-based query where the range is defined as { gte: 'prefix', lte: 'prefix' + delimiter }.

Boolean test(Term term, Range range);
};
</pre>
<p>
A RangeSource is a {{Source}} with added support for range-based
matching of quad Term(s).
</p>
<p>
<dfn>match()</dfn> Returns a stream that processes all quads matching
the pattern, the latter defined using a mix of Term(s) and {{Range}}(s).
<dfn>test()</dfn> Returns `true` when the provided Term falls within
the specified {{Range}}.
</p>
<p class="note">
When matching using {{Range}} object, instances <em>may</em> elect to
test whether a given Term falls within a specified {{Range}} based on
the logical values of the Term and the {{Range}} boundaries as opposed
to their literal values. A numerical Term, such as a literal Term
having the `xsd:integer` datatype, might be tested against similarly
defined {{Range}} boundaries based on their position on the spectrum of
real numbers rather than based on the lexicographical ordering of their
literal forms. Instances <em>may</em> allows this behaviour to be
enabled/disabled via an appropriate option passed to their constructors.
</p>
<p class="note">
The presence of the `test()` method <em>may</em> be used to evaluate
whether a {{Source}} instance is also a {{RangeSource}}.
</p>
</section>

<section data-dfn-for="Sink">
<h3><dfn>Sink</dfn> interface</h3>

Expand Down