Maintainer | Toshio Ito <debug.ito@gmail.com> |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
This module defines types and functions about TinkerPop graph structure API.
- class Element e where
- type ElementID e
- type ElementProperty e :: * -> *
- class Element v => Vertex v
- class Element e => Edge e where
- type EdgeVertexID e
- class Property p where
- data T a b
- tId :: Element a => Greskell (T a (ElementID a))
- tKey :: (Element (p v), Property p) => Greskell (T (p v) Text)
- tLabel :: Element a => Greskell (T a Text)
- tValue :: (Element (p v), Property p) => Greskell (T (p v) v)
- data Cardinality
- cList :: Greskell Cardinality
- cSet :: Greskell Cardinality
- cSingle :: Greskell Cardinality
- newtype Key a b = Key {}
- key :: Text -> Key a b
- data KeyValue a where
- (=:) :: Key a b -> Greskell b -> KeyValue a
- data AVertex = AVertex {}
- data AEdge = AEdge {
- aeId :: GValue
- aeLabel :: Text
- aeInVLabel :: Text
- aeOutVLabel :: Text
- aeInV :: GValue
- aeOutV :: GValue
- aeProperties :: PropertyMapSingle AProperty GValue
- data AVertexProperty v = AVertexProperty {
- avpId :: GValue
- avpLabel :: Text
- avpValue :: v
- avpProperties :: PropertyMapSingle AProperty GValue
- data AProperty v = AProperty {}
- class PropertyMap m where
- data PropertyMapSingle p v
- data PropertyMapList p v
- lookupOneValue :: (PropertyMap m, Property p) => Text -> m p v -> Maybe v
- lookupListValues :: (PropertyMap m, Property p) => Text -> m p v -> [v]
- parseOneValue :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser v
- parseListValues :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser [v]
- parseNonEmptyValues :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser (NonEmpty v)
- fromProperties :: (PropertyMap m, Property p, Monoid (m p v)) => [p v] -> m p v
- class FromGraphSONWithKey a
TinkerPop graph structure types
org.apache.tinkerpop.gremlin.structure.Element
interface in a
TinkerPop graph.
class Element v => Vertex v Source #
org.apache.tinkerpop.gremlin.structure.Vertex
interface in a
TinkerPop graph.
class Element e => Edge e Source #
org.apache.tinkerpop.gremlin.structure.Edge
interface in a
TinkerPop graph.
type EdgeVertexID e Source #
ID type of the Vertex
this edge connects.
class Property p where Source #
org.apache.tinkerpop.gremlin.structure.Property
interface in a
TinkerPop graph.
propertyKey :: p v -> Text Source #
Get key of this property.
propertyValue :: p v -> v Source #
Get value of this property.
T Enum
org.apache.tinkerpop.gremlin.structure.T
enum.
T
is a token to get data b
from an Element a
.
ProjectionLike (Greskell (T s e)) Source # | |
GraphSONTyped (T a b) Source # | |
type ProjectionLikeStart (Greskell (T s e)) Source # | |
type ProjectionLikeEnd (Greskell (T s e)) Source # | |
Cardinality Enum
data Cardinality Source #
org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality
enum.
Since: 0.2.0.0
cList :: Greskell Cardinality Source #
list
Cardinality.
>>>
toGremlin cList
"list"
Since: 0.2.0.0
cSet :: Greskell Cardinality Source #
set
Cardinality.
Since: 0.2.0.0
cSingle :: Greskell Cardinality Source #
single
Cardinality.
Since: 0.2.0.0
Typed Key (accessor of a Property)
A property key accessing value b
in an Element a
. In Gremlin,
it's just a String type.
Functor (Key a) Source # | Unsafely convert the value type |
Eq (Key a b) Source # | |
Show (Key a b) Source # | |
IsString (Key a b) Source # | Gremlin String literal as a |
ToGreskell (Key a b) Source # | Unwrap |
ProjectionLike (Key s e) Source # | |
type GreskellReturn (Key a b) Source # | |
type ProjectionLikeStart (Key s e) Source # | |
type ProjectionLikeEnd (Key s e) Source # | |
key-value pair
Concrete data types
Concrete data types based on Aeson data types.
Element IDs and property values are all GValue
, because they are
highly polymorphic. ElementID
and EdgeVertexID
are GValue
,
too.
As for properties, you can use PropertyMap
and other type-classes
to manipulate them.
If you want to define your own graph structure types, see
README.md
for detail. Basically you can use FromGraphSON
instances of these
concrete data types to implement parsers for your own types.
NOTE: In version 0.1.1.0 and before, these conrete data types were
based on GraphSON Value
. In version 0.2.0.0, this was changed to
GValue
, so that it can parse nested data structures encoded in
GraphSON.
Vertex
General vertex type you can use for Vertex
class, based on
Aeson data types.
AVertex | |
|
Edge
General edge type you can use for Edge
class, based on Aeson
data types.
AEdge | |
|
VertexProperty
data AVertexProperty v Source #
General vertex property type you can use for VertexProperty, based on Aeson data types.
If you are not sure about the type v
, just use GValue
.
AVertexProperty | |
|
Functor AVertexProperty Source # | |
Foldable AVertexProperty Source # | |
Traversable AVertexProperty Source # | |
Property AVertexProperty Source # | |
Eq v => Eq (AVertexProperty v) Source # | |
Show v => Show (AVertexProperty v) Source # | |
FromGraphSON v => FromJSON (AVertexProperty v) Source # | In version 0.1.1.0 and before, the constraint was |
FromGraphSON v => FromGraphSON (AVertexProperty v) Source # | |
GraphSONTyped (AVertexProperty v) Source # | |
FromGraphSON v => FromGraphSONWithKey (AVertexProperty v) Source # | |
Element (AVertexProperty v) Source # | |
type ElementID (AVertexProperty v) Source # | |
type ElementProperty (AVertexProperty v) Source # | |
Property
General simple property type you can use for Property
class.
If you are not sure about the type v
, just use GValue
.
Functor AProperty Source # | |
Foldable AProperty Source # | |
Traversable AProperty Source # | |
Property AProperty Source # | |
Eq v => Eq (AProperty v) Source # | |
Ord v => Ord (AProperty v) Source # | |
Show v => Show (AProperty v) Source # | |
FromGraphSON v => FromJSON (AProperty v) Source # | Parse Property of GraphSON 1.0. In version 0.1.1.0 and before, the constraint was |
FromGraphSON v => FromGraphSON (AProperty v) Source # | Parse Property of GraphSON 1.0. |
GraphSONTyped (AProperty v) Source # | |
FromGraphSON v => FromGraphSONWithKey (AProperty v) Source # | |
PropertyMap
class PropertyMap m where Source #
Common basic operations supported by maps of properties.
lookupOne :: Text -> m p v -> Maybe (p v) Source #
Look up a property associated with the given key.
lookupList :: Text -> m p v -> [p v] Source #
Look up all properties associated with the given key.
putProperty :: Property p => p v -> m p v -> m p v Source #
Put a property into the map.
removeProperty :: Text -> m p v -> m p v Source #
Remove all properties associated with the given key.
allProperties :: m p v -> [p v] Source #
Return all properties in the map.
data PropertyMapSingle p v Source #
A PropertyMap
that has a single value per key.
putProperty
replaces the old property by the given property.
<>
returns the union of the two given property maps. If the two
property maps share some same keys, the value from the left map
wins.
PropertyMap PropertyMapSingle Source # | |
Functor p => Functor (PropertyMapSingle p) Source # | |
Foldable p => Foldable (PropertyMapSingle p) Source # | |
Traversable p => Traversable (PropertyMapSingle p) Source # | |
Eq (p v) => Eq (PropertyMapSingle p v) Source # | |
Show (p v) => Show (PropertyMapSingle p v) Source # | |
Semigroup (PropertyMapSingle p v) Source # | |
Monoid (PropertyMapSingle p v) Source # | |
(Property p, GraphSONTyped (p v), FromGraphSON (p v), FromGraphSONWithKey (p v)) => FromJSON (PropertyMapSingle p v) Source # | In version 0.1.1.0 and before, the constraint was |
(Property p, GraphSONTyped (p v), FromGraphSON (p v), FromGraphSONWithKey (p v)) => FromGraphSON (PropertyMapSingle p v) Source # | |
data PropertyMapList p v Source #
A PropertyMap
that can keep more than one values per key.
lookupOne
returns the first property associated with the given
key.
putProperty
prepends the given property to the property list.
<>
returns the union of the two given property maps. If the two
property maps share some same keys, those property lists are
concatenated.
PropertyMap PropertyMapList Source # | |
Functor p => Functor (PropertyMapList p) Source # | |
Foldable p => Foldable (PropertyMapList p) Source # | |
Traversable p => Traversable (PropertyMapList p) Source # | |
Eq (p v) => Eq (PropertyMapList p v) Source # | |
Show (p v) => Show (PropertyMapList p v) Source # | |
Semigroup (PropertyMapList p v) Source # | |
Monoid (PropertyMapList p v) Source # | |
(Property p, GraphSONTyped (p v), FromGraphSON (p v), FromGraphSONWithKey (p v)) => FromJSON (PropertyMapList p v) Source # | In version 0.1.1.0 and before, the constraint was |
(Property p, GraphSONTyped (p v), FromGraphSON (p v), FromGraphSONWithKey (p v)) => FromGraphSON (PropertyMapList p v) Source # | |
lookupOneValue :: (PropertyMap m, Property p) => Text -> m p v -> Maybe v Source #
Lookup a property value from a PropertyMap
by key.
lookupListValues :: (PropertyMap m, Property p) => Text -> m p v -> [v] Source #
Lookup a list of property values from a PropertyMap
by key.
parseOneValue :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser v Source #
parseListValues :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser [v] Source #
Lookup a list of property values from a PropertyMap
by the
given key, and parse them.
In version 0.1.1.0 and before, this function took an argument m p (GraphSON Value)
.
This has changed, because property types for AVertex
etc have changed.
parseNonEmptyValues :: (PropertyMap m, Property p, FromGraphSON v) => Text -> m p GValue -> Parser (NonEmpty v) Source #
Like parseListValues
, but this function fail
s when there is
no property with the given key.
In version 0.1.1.0 and before, this function took an argument m p (GraphSON Value)
.
This has changed, because property types for AVertex
etc have changed.
fromProperties :: (PropertyMap m, Property p, Monoid (m p v)) => [p v] -> m p v Source #
Create a PropertyMap
from list of Property
s.
Internal use
class FromGraphSONWithKey a Source #
This typeclass is for internal use.
GraphSON parser with a property key given from outside.
Since: 0.2.0.0
parseGraphSONWithKey
FromGraphSON v => FromGraphSONWithKey (AVertexProperty v) Source # | |
FromGraphSON v => FromGraphSONWithKey (AProperty v) Source # | |