Exemple #1
0
    def dictify(cls, obj, writer):
        """

        Args:
            obj (X):
            writer:

        Returns:

        """

        value = obj.objectify()
        serializedJSON = GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE, value,
                                                 cls.GRAPHSON_PREFIX)
        cls.serializedJSON = serializedJSON
        return serializedJSON
Exemple #2
0
    def dictify(cls, relationID, writer):
        """ Serializes RelationIdentifier object.

        Args:
            relationID (RelationIdentifier): The RelationID to serialize.
            writer:

        Returns:
            json
        """

        relationJSON = cls.__relationID_to_dict(relationID)

        serializedJSON = GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE,
                                                 relationJSON,
                                                 cls.GRAPHSON_PREFIX)

        return serializedJSON
Exemple #3
0
    def dictify(cls, circle, writer):
        """ This is serializer method for Circle class.

        Args:
            circle (Circle): The GeoShape Circle object to serialize
            writer : The Gremlin GraphSON writer object to used during serializing.

        Returns:
            json
        """

        geometryJSON = toGeoJSON(circle).convert()

        serializedJSON = GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE,
                                                 geometryJSON,
                                                 cls.GRAPHSON_PREFIX)

        return serializedJSON
    def dictify(cls, point, writer):
        """ This is serializer method for Point class.

        Args:
            point (Point): The GeoShape Point class to serialize into.
            writer:

        Returns:
            json
        """

        geometryJSON = toGeoJSON(point).convert()

        serializedJSON = GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE,
                                                 geometryJSON,
                                                 cls.GRAPHSON_PREFIX)

        return serializedJSON
Exemple #5
0
 def serialize(self, obj):
     value = obj.objectify()
     serializedJSON = GraphSONUtil.typedValue(self.GRAPHSON_BASE_TYPE,
                                              value, self.GRAPHSON_PREFIX)
     self.serializedJSON = serializedJSON
     return self