Maintainer | Toshio Ito <debug.ito@gmail.com> |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
This module defines types and functions about TinkerPop graph structure API.
Synopsis
- 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.
ID type of the Element
. This depends on graph database
implementation and its settings.
type ElementProperty e :: * -> * Source #
Instances
Element AEdge Source # | |
Element AVertex Source # | |
Element (AVertexProperty v) Source # | |
Defined in Data.Greskell.Graph type ElementID (AVertexProperty v) :: * Source # type ElementProperty (AVertexProperty v) :: * -> * Source # |
class Element v => Vertex v Source #
org.apache.tinkerpop.gremlin.structure.Vertex
interface in a
TinkerPop graph.
Instances
Vertex AVertex Source # | |
Defined in Data.Greskell.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.
Instances
Edge AEdge Source # | |
Defined in Data.Greskell.Graph type EdgeVertexID AEdge :: * Source # |
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.
Instances
Property AVertexProperty Source # | |
Defined in Data.Greskell.Graph propertyKey :: AVertexProperty v -> Text Source # propertyValue :: AVertexProperty v -> v Source # | |
Property AProperty Source # | |
Defined in Data.Greskell.Graph propertyKey :: AProperty v -> Text Source # propertyValue :: AProperty v -> v Source # |
T Enum
org.apache.tinkerpop.gremlin.structure.T
enum.
T
is a token to get data b
from an Element a
.
Instances
ProjectionLike (Greskell (T s e)) Source # | |
Defined in Data.Greskell.GTraversal | |
GraphSONTyped (T a b) Source # | |
Defined in Data.Greskell.Graph gsonTypeFor :: T a b -> Text # | |
type ProjectionLikeStart (Greskell (T s e)) Source # | |
Defined in Data.Greskell.GTraversal | |
type ProjectionLikeEnd (Greskell (T s e)) Source # | |
Defined in Data.Greskell.GTraversal |
Cardinality Enum
data Cardinality Source #
org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality
enum.
Since: greskell-0.2.0.0
cList :: Greskell Cardinality Source #
list
Cardinality.
>>>
toGremlin cList
"list"
Since: greskell-0.2.0.0
cSet :: Greskell Cardinality Source #
set
Cardinality.
Since: greskell-0.2.0.0
cSingle :: Greskell Cardinality Source #
single
Cardinality.
Since: greskell-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.
Instances
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 |
Defined in Data.Greskell.Graph fromString :: String -> Key a b # | |
ToGreskell (Key a b) Source # | Unwrap |
Defined in Data.Greskell.Graph type GreskellReturn (Key a b) :: * # toGreskell :: Key a b -> Greskell (GreskellReturn (Key a b)) # | |
ProjectionLike (Key s e) Source # | |
Defined in Data.Greskell.GTraversal type ProjectionLikeStart (Key s e) :: * Source # type ProjectionLikeEnd (Key s e) :: * Source # | |
type GreskellReturn (Key a b) Source # | |
Defined in Data.Greskell.Graph | |
type ProjectionLikeStart (Key s e) Source # | |
Defined in Data.Greskell.GTraversal | |
type ProjectionLikeEnd (Key s e) Source # | |
Defined in Data.Greskell.GTraversal |
key-value pair
(=:) :: Key a b -> Greskell b -> KeyValue a Source #
Constructor operator of KeyValue
.
Since: greskell-0.2.0.0
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 | |
|
Instances
Eq AVertex Source # | |
Show AVertex Source # | |
FromJSON AVertex Source # | |
FromGraphSON AVertex Source # | |
Defined in Data.Greskell.Graph parseGraphSON :: GValue -> Parser AVertex # | |
GraphSONTyped AVertex Source # | |
Defined in Data.Greskell.Graph gsonTypeFor :: AVertex -> Text # | |
Vertex AVertex Source # | |
Defined in Data.Greskell.Graph | |
Element AVertex Source # | |
type ElementID AVertex Source # | |
Defined in Data.Greskell.Graph | |
type ElementProperty AVertex Source # | |
Defined in Data.Greskell.Graph |
Edge
General edge type you can use for Edge
class, based on Aeson
data types.
AEdge | |
|
Instances
Eq AEdge Source # | |
Show AEdge Source # | |
FromJSON AEdge Source # | |
FromGraphSON AEdge Source # | |
Defined in Data.Greskell.Graph parseGraphSON :: GValue -> Parser AEdge # | |
GraphSONTyped AEdge Source # | |
Defined in Data.Greskell.Graph gsonTypeFor :: AEdge -> Text # | |
Edge AEdge Source # | |
Defined in Data.Greskell.Graph type EdgeVertexID AEdge :: * Source # | |
Element AEdge Source # | |
type EdgeVertexID AEdge Source # | |
Defined in Data.Greskell.Graph | |
type ElementID AEdge Source # | |
Defined in Data.Greskell.Graph | |
type ElementProperty AEdge Source # | |
Defined in Data.Greskell.Graph |
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 | |
|
Instances
Property
General simple property type you can use for Property
class.
If you are not sure about the type v
, just use GValue
.
Instances
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.
Instances
PropertyMap PropertyMapList Source # | |
Defined in Data.Greskell.Graph lookupOne :: Text -> PropertyMapList p v -> Maybe (p v) Source # lookupList :: Text -> PropertyMapList p v -> [p v] Source # putProperty :: Property p => p v -> PropertyMapList p v -> PropertyMapList p v Source # removeProperty :: Text -> PropertyMapList p v -> PropertyMapList p v Source # allProperties :: PropertyMapList p v -> [p v] Source # | |
PropertyMap PropertyMapSingle Source # | |
Defined in Data.Greskell.Graph lookupOne :: Text -> PropertyMapSingle p v -> Maybe (p v) Source # lookupList :: Text -> PropertyMapSingle p v -> [p v] Source # putProperty :: Property p => p v -> PropertyMapSingle p v -> PropertyMapSingle p v Source # removeProperty :: Text -> PropertyMapSingle p v -> PropertyMapSingle p v Source # allProperties :: PropertyMapSingle p v -> [p v] Source # |
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.
Instances
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.
Instances
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: greskell-0.2.0.0
parseGraphSONWithKey
Instances
FromGraphSON v => FromGraphSONWithKey (AVertexProperty v) Source # | |
Defined in Data.Greskell.Graph parseGraphSONWithKey :: Text -> GValue -> Parser (AVertexProperty v) | |
FromGraphSON v => FromGraphSONWithKey (AProperty v) Source # | |
Defined in Data.Greskell.Graph parseGraphSONWithKey :: Text -> GValue -> Parser (AProperty v) |