[−][src]Struct owoof::projection::Projection
A collection of datom-sets with constraints relating them.
This references attributes and entities by their handles/public representations.
Implementations
impl<'a, V> Projection<'a, V> where
V: Debug + HasAffinity,
[src]
V: Debug + HasAffinity,
pub fn from_patterns(patterns: &'a [Pattern<'_, V>]) -> Self
[src]
pub fn datomsets(&self) -> usize
[src]
pub fn variables(&self) -> &HashMap<&'a str, Location>
[src]
pub fn constraints(&self) -> &Vec<Constraint<'a, V>>
[src]
pub fn variable(&self, n: &str) -> Option<Location>
[src]
Return the first location (if any) where this variable was used.
pub fn var(&self, n: &str) -> Option<Location>
[src]
pub fn variable_locations(&self, n: &str) -> impl Iterator<Item = Location> + '_
[src]
As Projection::constrained_to
but looks up the variable's location of first use.
Note, this doesn't search every spot the variable might have been used; we don't track that. It will only return locations constrainted the the location of the variable's first use.
This should be fine if you're using Projection::constrain_variable()
or
Projection::variable()
to get a variable's location when building
constraints, since those will always return the variable's location of first
use.
pub fn constrained_to(
&self,
loc: Location
) -> impl Iterator<Item = Location> + '_
[src]
&self,
loc: Location
) -> impl Iterator<Item = Location> + '_
Find Location
s with an equality constraint on this location.
pub fn add_datomset(&mut self) -> DatomSet
[src]
pub fn add_constraint(&mut self, c: Constraint<'a, V>)
[src]
This is needed to add non-equality constraints
pub fn constrain_variable(&mut self, variable: &'a str, location: Location)
[src]
Register a variable at some location. If it was registered before, constraint the existing variable to the given location.
Nothing happens if this receives the anonymous variable (the empty string). TODO this may never be what anybody wants at all ever...
pub fn constrain_field<I>(&mut self, location: Location, i: I) where
I: Into<Concept<'a, V>>,
[src]
I: Into<Concept<'a, V>>,
pub fn add_patterns(&mut self, patterns: &'a [Pattern<'_, V>])
[src]
pub fn add_pattern<'p: 'a>(&mut self, pattern: &'p Pattern<'_, V>) -> DatomSet
[src]
Appends a datomset to the projection with Projection::add_datomset
,
constraining each entity-attribute-value to either a variable or a value based
on the given Pattern
.
pub fn select<'s, S>(&'s mut self, s: S) -> Selection<'s, 'a, V, S>
[src]
Select allows us to get an object we can pass to crate::Session::find
that
can resolve query results into a vector or maybe tuples I think too.
See the [owoof::projection] module documentation for an example.
pub fn entity_group<'p>(
&'p mut self,
var: &'a str
) -> Option<EntityGroup<'p, 'a, V>> where
'a: 'p,
[src]
&'p mut self,
var: &'a str
) -> Option<EntityGroup<'p, 'a, V>> where
'a: 'p,
This is part of representing a bunch of datomsets all constrained to the same entity. Suppose you've got ...
?birthday-person :person/birthday ?today ?birthday-person :person/name ?name ?birthday-person :person/age ?age
... using Projection::select
we can ask for the values of specific locations and
end up with a sequence or [?name ?age]
for each ?birthday-person
or something.
But using an EntityGroup
allows us to construct an AttributeMap
which
implements crate::sql::ReadFromRow
to produce a HashMap
on attributes to
values.
So instead of ending up with a sequence for each matching "object" we get a map. Which might be nice sometimes like if you want to serialize a self-describing JSON document.
See the [owoof::projection] module documentation for an example.
pub fn attribute_map<'p, I>(
&mut self,
top: &'a str,
attrs: I
) -> AttributeMap<'p, V> where
'a: 'p,
I: IntoIterator<Item = &'a AttributeName<'a>>,
[src]
&mut self,
top: &'a str,
attrs: I
) -> AttributeMap<'p, V> where
'a: 'p,
I: IntoIterator<Item = &'a AttributeName<'a>>,
short-hand for Projection::entity_group
& EntityGroup::attribute_map
.
Trait Implementations
impl<'a, V: Debug> Debug for Projection<'a, V>
[src]
impl<'a, V> Default for Projection<'a, V>
[src]
Auto Trait Implementations
impl<'a, V> RefUnwindSafe for Projection<'a, V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, V> Send for Projection<'a, V> where
V: Sync,
V: Sync,
impl<'a, V> Sync for Projection<'a, V> where
V: Sync,
V: Sync,
impl<'a, V> Unpin for Projection<'a, V>
impl<'a, V> UnwindSafe for Projection<'a, V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,