| Maintainer | Toshio Ito <debug.ito@gmail.com> |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Greskell.Graph
Contents
Description
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
- propertyKey :: p v -> Text
- propertyValue :: p v -> v
- 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
- lookupOne :: Text -> m p v -> Maybe (p v)
- lookupList :: Text -> m p v -> [p v]
- putProperty :: Property p => p v -> m p v -> m p v
- removeProperty :: Text -> m p v -> m p v
- allProperties :: m p v -> [p v]
- 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.
Associated Types
ID type of the Element. This depends on graph database
implementation and its settings.
type ElementProperty e :: * -> * #
Instances
| Element AEdge # | |
Defined in Data.Greskell.Graph | |
| Element AVertex # | |
Defined in Data.Greskell.Graph | |
| Element (AVertexProperty v) # | |
Defined in Data.Greskell.Graph Associated Types type ElementID (AVertexProperty v) :: Type # type ElementProperty (AVertexProperty v) :: Type -> Type # | |
org.apache.tinkerpop.gremlin.structure.Vertex interface in a
TinkerPop graph.
Instances
| Vertex AVertex # | |
Defined in Data.Greskell.Graph | |
org.apache.tinkerpop.gremlin.structure.Edge interface in a
TinkerPop graph.
Instances
| Edge AEdge # | |
Defined in Data.Greskell.Graph Associated Types type EdgeVertexID AEdge :: Type # | |
org.apache.tinkerpop.gremlin.structure.Property interface in a
TinkerPop graph.
Methods
propertyKey :: p v -> Text #
Get key of this property.
propertyValue :: p v -> v #
Get value of this property.
Instances
| Property AVertexProperty # | |
Defined in Data.Greskell.Graph | |
| Property AProperty # | |
Defined in Data.Greskell.Graph | |
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)) # | |
Defined in Data.Greskell.GTraversal Associated Types type ProjectionLikeStart (Greskell (T s e)) :: Type # type ProjectionLikeEnd (Greskell (T s e)) :: Type # | |
| GraphSONTyped (T a b) # | |
Defined in Data.Greskell.Graph Methods gsonTypeFor :: T a b -> Text # | |
| type ProjectionLikeStart (Greskell (T s e)) # | |
Defined in Data.Greskell.GTraversal | |
| type ProjectionLikeEnd (Greskell (T s e)) # | |
Defined in Data.Greskell.GTraversal | |
Cardinality Enum
data Cardinality #
org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality enum.
Since: 0.2.0.0
cList :: Greskell Cardinality #
list Cardinality.
>>>toGremlin cList"list"
Since: 0.2.0.0
cSet :: Greskell Cardinality #
set Cardinality.
Since: 0.2.0.0
cSingle :: Greskell Cardinality #
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.
Instances
| Functor (Key a) # | Unsafely convert the value type |
| Eq (Key a b) # | |
| Show (Key a b) # | |
| IsString (Key a b) # | Gremlin String literal as a |
Defined in Data.Greskell.Graph Methods fromString :: String -> Key a b # | |
| ToGreskell (Key a b) # | Unwrap |
Defined in Data.Greskell.Graph Associated Types type GreskellReturn (Key a b) :: Type # Methods toGreskell :: Key a b -> Greskell (GreskellReturn (Key a b)) # | |
| ProjectionLike (Key s e) # | |
Defined in Data.Greskell.GTraversal Associated Types type ProjectionLikeStart (Key s e) :: Type # type ProjectionLikeEnd (Key s e) :: Type # | |
| type GreskellReturn (Key a b) # | |
Defined in Data.Greskell.Graph | |
| type ProjectionLikeStart (Key s e) # | |
Defined in Data.Greskell.GTraversal | |
| type ProjectionLikeEnd (Key s e) # | |
Defined in Data.Greskell.GTraversal | |
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.
Constructors
| AVertex | |
Fields
| |
Instances
| Eq AVertex # | |
| Show AVertex # | |
| FromJSON AVertex # | |
| FromGraphSON AVertex # | |
Defined in Data.Greskell.Graph Methods parseGraphSON :: GValue -> Parser AVertex # | |
| GraphSONTyped AVertex # | |
Defined in Data.Greskell.Graph Methods gsonTypeFor :: AVertex -> Text # | |
| Vertex AVertex # | |
Defined in Data.Greskell.Graph | |
| Element AVertex # | |
Defined in Data.Greskell.Graph | |
| type ElementID AVertex # | |
Defined in Data.Greskell.Graph | |
| type ElementProperty AVertex # | |
Defined in Data.Greskell.Graph | |
Edge
General edge type you can use for Edge class, based on Aeson
data types.
Constructors
| AEdge | |
Fields
| |
Instances
| Eq AEdge # | |
| Show AEdge # | |
| FromJSON AEdge # | |
| FromGraphSON AEdge # | |
Defined in Data.Greskell.Graph Methods parseGraphSON :: GValue -> Parser AEdge # | |
| GraphSONTyped AEdge # | |
Defined in Data.Greskell.Graph Methods gsonTypeFor :: AEdge -> Text # | |
| Edge AEdge # | |
Defined in Data.Greskell.Graph Associated Types type EdgeVertexID AEdge :: Type # | |
| Element AEdge # | |
Defined in Data.Greskell.Graph | |
| type EdgeVertexID AEdge # | |
Defined in Data.Greskell.Graph | |
| type ElementID AEdge # | |
Defined in Data.Greskell.Graph | |
| type ElementProperty AEdge # | |
Defined in Data.Greskell.Graph | |
VertexProperty
data AVertexProperty v #
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.
Constructors
| AVertexProperty | |
Fields
| |
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 #
Common basic operations supported by maps of properties.
Minimal complete definition
Methods
lookupOne :: Text -> m p v -> Maybe (p v) #
Look up a property associated with the given key.
lookupList :: Text -> m p v -> [p v] #
Look up all properties associated with the given key.
putProperty :: Property p => p v -> m p v -> m p v #
Put a property into the map.
removeProperty :: Text -> m p v -> m p v #
Remove all properties associated with the given key.
allProperties :: m p v -> [p v] #
Return all properties in the map.
Instances
| PropertyMap PropertyMapList # | |
Defined in Data.Greskell.Graph Methods lookupOne :: Text -> PropertyMapList p v -> Maybe (p v) # lookupList :: Text -> PropertyMapList p v -> [p v] # putProperty :: Property p => p v -> PropertyMapList p v -> PropertyMapList p v # removeProperty :: Text -> PropertyMapList p v -> PropertyMapList p v # allProperties :: PropertyMapList p v -> [p v] # | |
| PropertyMap PropertyMapSingle # | |
Defined in Data.Greskell.Graph Methods lookupOne :: Text -> PropertyMapSingle p v -> Maybe (p v) # lookupList :: Text -> PropertyMapSingle p v -> [p v] # putProperty :: Property p => p v -> PropertyMapSingle p v -> PropertyMapSingle p v # removeProperty :: Text -> PropertyMapSingle p v -> PropertyMapSingle p v # allProperties :: PropertyMapSingle p v -> [p v] # | |
data PropertyMapSingle p v #
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 #
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 #
Lookup a property value from a PropertyMap by key.
lookupListValues :: (PropertyMap m, Property p) => Text -> m p v -> [v] #
Lookup a list of property values from a PropertyMap by key.
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] #
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) #
Like parseListValues, but this function fails 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 #
Create a PropertyMap from list of Propertys.
Internal use
class FromGraphSONWithKey a #
This typeclass is for internal use.
GraphSON parser with a property key given from outside.
Since: 0.2.0.0
Minimal complete definition
parseGraphSONWithKey
Instances
| FromGraphSON v => FromGraphSONWithKey (AVertexProperty v) # | |
Defined in Data.Greskell.Graph Methods parseGraphSONWithKey :: Text -> GValue -> Parser (AVertexProperty v) | |
| FromGraphSON v => FromGraphSONWithKey (AProperty v) # | |
Defined in Data.Greskell.Graph Methods parseGraphSONWithKey :: Text -> GValue -> Parser (AProperty v) | |