Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarocosta committed Mar 1, 2020
1 parent 278f6aa commit 905fbbb
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 31 deletions.
2 changes: 2 additions & 0 deletions src/Models/CRM/v5_0_2/NodeEntities/E18_Physical_Thing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from neomodel import RelationshipFrom, RelationshipTo, StructuredRel
from src.GCF.decorators.OntologyClass import ontology_class
from src.Models.CRM.v5_0_2.NodeEntities.E6_Destruction import E6_Destruction
from src.Models.CRM.v5_0_2.NodeEntities.E72_Legal_Object import \
E72_Legal_Object
Expand All @@ -19,6 +20,7 @@ class P13_destroyed(StructuredRel):
pass


@ontology_class
class E18_Physical_Thing(E72_Legal_Object):
is_composed_of = RelationshipTo(
".E18_Physical_Thing.E18_Physical_Thing",
Expand Down
4 changes: 0 additions & 4 deletions src/Models/DataObject/v0_0_2/Approximate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema

from neomodel import DateTimeProperty
from src.Models.DataObject.v0_0_2.Date import Date

Expand All @@ -21,6 +20,3 @@ def getSchema(self):

class ApproximateSchema(Schema):
approximateDateValue = fields.Date(required=True)



3 changes: 0 additions & 3 deletions src/Models/DataObject/v0_0_2/DataObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ def getSchema(self):
class DataObjectSchema(Schema):
uid = fields.String()
name = fields.String(required=True)



3 changes: 0 additions & 3 deletions src/Models/DataObject/v0_0_2/Instant.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ def getSchema(self):

class InstantSchema(Schema):
timestamp = fields.Date(required=True)



3 changes: 0 additions & 3 deletions src/Models/DataObject/v0_0_2/Interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ def getSchema(self):
class IntervalSchema(Schema):
startDateValue = fields.Date(required=True)
endDateValue = fields.Date(required=True)



7 changes: 2 additions & 5 deletions src/Models/DataObject/v0_0_2/PersonName.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json

from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema
from neomodel import StringProperty
import json

from src.Models.DataObject.v0_0_2.AuthorityString import AuthorityString


Expand All @@ -20,6 +20,3 @@ def getSchema(self):

class PersonNameSchema(Schema):
name = fields.String(required=True)



4 changes: 1 addition & 3 deletions src/Models/DataObject/v0_0_2/RegexString.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json

from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema
from neomodel import RegexProperty
Expand All @@ -19,6 +20,3 @@ def getSchema(self):

class RegexStringSchema(Schema):
hasRegex = fields.String(required=True)



16 changes: 9 additions & 7 deletions src/Routes/routes.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
from json import dumps
from flask import Flask, g, Response, request, jsonify
from neomodel import (config)
from flask import Flask, jsonify

from neomodel import config
from src.Models.DataObject.v0_0_2.String import String
config.DATABASE_URL = 'bolt://neo4j:password@localhost:7687'

config.DATABASE_URL = "bolt://neo4j:password@localhost:7687"
app = Flask(__name__, static_url_path="")


@app.route("/<uid>", methods=['GET'])
@app.route("/<uid>", methods=["GET"])
def view(uid):
returned_string = String.nodes.get(uid=uid)
return jsonify(returned_string.toJSON())
# returned_string = String.nodes.get(uid=uid)
# return Response(dumps(returned_string.toJSON()), mimetype='application/json')
# return Response(dumps(returned_string.toJSON()),
# mimetype='application/json')


@app.route("/schema/<uid>", methods=['GET'])
@app.route("/schema/<uid>", methods=["GET"])
def getSchema(uid):
returned_string = String.nodes.get(uid=uid)
return jsonify(returned_string.getSchema())
Expand Down
4 changes: 1 addition & 3 deletions test/Unit/test_data_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
AttemptedCardinalityViolation)
import json

from src.Utils.JsonEncoder import json_merge

config.DATABASE_URL = 'bolt://neo4j:password@localhost:7687'
date = datetime.datetime.now().strftime("%H:%M:%S")

Expand All @@ -23,5 +21,5 @@ def test_create_update_string_Node(self):
returned_string.save()
change_returned_string = String.nodes.get(name=date)
self.assertAlmostEqual(string.id, returned_string.id)
self.assertAlmostEqual(change_returned_string.stringValue, new_name)
self.assertEqual(change_returned_string.stringValue, new_name)
self.assertAlmostEqual(string.id, change_returned_string.id)

0 comments on commit 905fbbb

Please sign in to comment.