where timestamp has a form like this "timestamp": "2019\09\04 11:01:33"
Is it possible match all node between a specific date or time like from 2019/09 to 2019/01 ?
thanks
If the year is before 0000 or after 9999, the following additional rules apply:
- must prefix any year before 0000
+ must prefix any year after 9999
The year must be separated from the next component with the following characters:
- if the next component is month or day of the year
Either - or W if the next component is week of the year
Q if the next component is quarter of the year
If the year component is prefixed with either - or +, and is separated from the next componen
So using / as the delimiter within the date component is not allowed
in the end provided you get the correct format you should then be able to run
match(n:MyNode)
where date(datetime(n:timestamp_prop))='2019-09-04' or
date(datetime(n:timestamp_prop))< 12019-09-05`;
To create every node, I use the Facebook Graph api to take every post. In particular I used this code in Python to connect with neo4j db and to create my nodes
allPosts = [ ]
class Post:
def __init__(self, id, message, time, application):
self.id = id
self.message = message
self.time = time
self.application = application
def __repr__(self):
return '<Event object ({} {} {} {})>'.format(self.id, self.message, self.time, self.application)
def __str__(self):
return '{} {} {} {}'.format(self.id, self.message, self.time, self.application)
def takePosts(postNum):
profile = fbgraph.get_object("me")
posts = fbgraph.get_connections(profile["id"], "posts")
i = 0
while True:
try:
for post in posts["data"]:
if i == int(postNum):
return
if 'message' in post:
if 'application' in post:
allPosts.append(Post(post['id'], post['message'].encode('utf-8'), post['created_time'],post['application']['name']))
else:
allPosts.append(Post(post['id'], post['message'].encode('utf-8'), post['created_time'], 'share by facebook application'))
else:
if 'application' in post:
allPosts.append(Post(post['id'], 'no message share', post['created_time'], post['application']['name']))
else:
allPosts.append(Post(post['id'], 'no message share', post['created_time'], 'share by facebook application'))
i += 1
# Attempt to make a request to the next page of data, if it exists.
posts = requests.get(posts["paging"]["next"]).json()
except KeyError:
return
def createNode():
length = len(fb.allPosts)
for post in range(0,length):
id = fb.allPosts[post].id
message = fb.allPosts[post].message
time = fb.allPosts[post].time
application = fb.allPosts[post].application
node = Node("Post", id=id, message=message, timestamp=time, application=application)
graph.create(node)
ok.. couple of concerns. my post earlier with the answer was syntactically incorrect in that
match(n:MyNode)
where date(datetime(n:timestamp))='2019-09-04' or
date(datetime(n:timestamp))< 2019-09-05'
return n
should be
match(n:MyNode)
where date(datetime(n.timestamp))='2019-09-04' or
date(datetime(n.timestamp))< '2019-09-05`
return n
such that the change is that the where clause previously referred to n:timestamp when it should have be n.timestamp (presuming the name of your property is named timestamp), and again enclosing 2019-09-05 in single quotes.