-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21291fa
commit 0daacc3
Showing
19 changed files
with
217 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
import json | ||
|
||
from marshmallow import Schema, fields | ||
from marshmallow_jsonschema import JSONSchema | ||
from neomodel import DateTimeProperty | ||
from marshmallow import fields | ||
from neomodel import DateTimeProperty, config | ||
from src.Models.DataObject.v0_0_2.Date import Date, DateSchema | ||
|
||
from src.Models.DataObject.v0_0_2 import SerializeClass | ||
from src.Models.DataObject.v0_0_2.Date import Date | ||
config.DATABASE_URL = "bolt://neo4j:password@localhost:7687" | ||
|
||
|
||
class ApproximateSchema(Schema): | ||
class ApproximateSchema(DateSchema): | ||
approximateDateValue = fields.Date(required=True) | ||
|
||
|
||
class Approximate(Date): | ||
super(SerializeClass).__init__(ApproximateSchema) | ||
approximateDateValue = DateTimeProperty(unique_index=True, required=True) | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = ApproximateSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) | ||
self.list.append(self.approximateDateValue.__str__()) | ||
|
||
|
||
# print(ApproximateSchema()) | ||
# datetime_object = datetime.datetime(2020, 5, 17) | ||
# print(datetime_object) | ||
# a = Approximate(name="name", approximateDateValue=datetime_object, ).save() | ||
# print(a.toJSON()) | ||
# print(a.getSchema()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class AuthorityFileSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class AuthorityFile(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = AuthorityFileSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
from src.Models.DataObject.v0_0_2.String import String | ||
from src.Models.DataObject.v0_0_2.String import String, StringSchema | ||
|
||
|
||
class AuthorityStringSchema(StringSchema): | ||
pass | ||
|
||
|
||
class AuthorityString(String): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = AuthorityStringSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class BooleanSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class Boolean(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = BooleanSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
import json | ||
|
||
from marshmallow import Schema, fields | ||
from neomodel import StringProperty, StructuredNode, UniqueIdProperty, config | ||
|
||
from neomodel import StringProperty, StructuredNode, UniqueIdProperty | ||
from src.Models.DataObject.v0_0_2.SerializeClass import SerializeClass | ||
|
||
config.DATABASE_URL = 'bolt://neo4j:password@localhost:7687' | ||
#from src.GCF.utils.db import clean_database | ||
#clean_database() | ||
# config.DATABASE_URL = 'bolt://neo4j:password@localhost:7687' | ||
# from src.GCF.utils.db import clean_database | ||
# clean_database() | ||
|
||
|
||
class DataObjectSchema(Schema): | ||
uid = fields.String() | ||
name = fields.String(required=True) | ||
|
||
|
||
class DataObject(StructuredNode, SerializeClass, Schema): | ||
class DataObject(StructuredNode, SerializeClass): | ||
name = StringProperty(unique_index=True, required=True) | ||
uid = UniqueIdProperty() | ||
|
||
# def __init__(self, *args, **kwargs): | ||
# super().__init__(*args, **kwargs) | ||
# SerializeClass.__init__(self, schema=DataObjectSchema()) | ||
# self.list.extend([self.uid, self.name]) | ||
|
||
def __init__(self, schema, *args, **kwargs): | ||
def __init__(self, schema=None, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
SerializeClass.__init__(self, schema=DataObjectSchema()) | ||
if schema is None: | ||
schema = DataObjectSchema() | ||
|
||
SerializeClass.__init__(self, schema) | ||
self.schema = schema | ||
self.list.extend([self.uid, self.name]) | ||
|
||
|
||
#ola =DataObject(name="ola").save() | ||
# #ola.getSchema() | ||
# ola =DataObject(name="ola").save() | ||
# ola.getSchema() | ||
# print(ola.toJSON()) | ||
# ola.nodes.get(name="ola") | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class DateSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class Date(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = DateSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class DecimalSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class Decimal(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = DecimalSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class GeospatialCoordinatesSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class GeospatialCoordinates(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = GeospatialCoordinatesSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import json | ||
|
||
from marshmallow import Schema, fields | ||
from marshmallow_jsonschema import JSONSchema | ||
from marshmallow import fields | ||
from neomodel import DateTimeProperty | ||
from src.Models.DataObject.v0_0_2.Date import Date | ||
from src.Models.DataObject.v0_0_2.Date import Date, DateSchema | ||
|
||
|
||
class InstantSchema(Schema): | ||
class InstantSchema(DateSchema): | ||
timestamp = fields.Date(required=True) | ||
|
||
|
||
class Instant(Date): | ||
timestamp = DateTimeProperty(unique_index=True, required=True) | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = InstantSchema() | ||
|
||
|
||
super().__init__(schema, *args, **kwargs) | ||
self.list.append(self.timestamp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
from src.Models.DataObject.v0_0_2.DataObject import (DataObject, | ||
DataObjectSchema) | ||
|
||
|
||
class IntegerSchema(DataObjectSchema): | ||
pass | ||
|
||
|
||
class Integer(DataObject): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = IntegerSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
from marshmallow import Schema, fields | ||
from marshmallow import fields | ||
from neomodel import DateTimeProperty | ||
from src.Models.DataObject.v0_0_2.Date import Date, DateSchema | ||
|
||
from src.Models.DataObject.v0_0_2 import SerializeClass | ||
from src.Models.DataObject.v0_0_2.Date import Date | ||
|
||
|
||
class IntervalSchema(Schema): | ||
class IntervalSchema(DateSchema): | ||
startDateValue = fields.Date(required=True) | ||
endDateValue = fields.Date(required=True) | ||
|
||
|
||
class Interval(Date): | ||
super(SerializeClass).__init__(IntervalSchema) | ||
startDateValue = DateTimeProperty(unique_index=True, required=True) | ||
endDateValue = DateTimeProperty(unique_index=True, required=True) | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = IntervalSchema() | ||
|
||
|
||
|
||
super().__init__(schema, *args, **kwargs) | ||
self.list.extend([self.startDateValue, self.startDateValue]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import \ | ||
GeospatialCoordinates | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import ( | ||
GeospatialCoordinates, GeospatialCoordinatesSchema) | ||
|
||
|
||
class LatitudeSchema(GeospatialCoordinatesSchema): | ||
pass | ||
|
||
|
||
class Latitude(GeospatialCoordinates): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = LatitudeSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import \ | ||
GeospatialCoordinates | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import ( | ||
GeospatialCoordinates, GeospatialCoordinatesSchema) | ||
|
||
|
||
class LongitudeSchema(GeospatialCoordinatesSchema): | ||
pass | ||
|
||
|
||
class Longitude(GeospatialCoordinates): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = LongitudeSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import json | ||
|
||
from marshmallow import Schema, fields | ||
from marshmallow_jsonschema import JSONSchema | ||
from marshmallow import fields | ||
from neomodel import StringProperty | ||
|
||
from src.Models.DataObject.v0_0_2 import SerializeClass | ||
from src.Models.DataObject.v0_0_2.AuthorityString import AuthorityString | ||
from src.Models.DataObject.v0_0_2.DataObject import DataObject | ||
|
||
#config.DATABASE_URL = "bolt://neo4j:password@localhost:7687" | ||
# from src.GCF.utils.db import clean_database | ||
# clean_database() | ||
|
||
|
||
class PersonNameSchema(Schema): | ||
class PersonNameSchema(DataObject): | ||
name = fields.String(required=True) | ||
|
||
|
||
class PersonName(AuthorityString): | ||
super(SerializeClass).__init__(PersonNameSchema) | ||
name = StringProperty(unique_index=True, required=True) | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = PersonNameSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) | ||
self.list.append(self.name) | ||
|
||
|
||
#a = PersonName(name="new").save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import \ | ||
GeospatialCoordinates | ||
from src.Models.DataObject.v0_0_2.GeospatialCoordinates import ( | ||
GeospatialCoordinates, GeospatialCoordinatesSchema) | ||
|
||
|
||
class PolygonSchema(GeospatialCoordinatesSchema): | ||
pass | ||
|
||
|
||
class Polygon(GeospatialCoordinates): | ||
pass | ||
|
||
def __init__(self, schema=None, *args, **kwargs): | ||
if schema is None: | ||
schema = PolygonSchema() | ||
|
||
super().__init__(schema, *args, **kwargs) |
Oops, something went wrong.