Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c03eda2
fix error in if-else statement in redis_setup.sh
krritik Feb 10, 2019
8a9102b
Merge pull request #81 solve issue running redis_setup.sh
Mec-iS Feb 23, 2019
370230a
Update gitignore to include Pipenv generated files
de-sh Feb 24, 2019
3947783
Update repo to use hydra_python_core module
de-sh Feb 25, 2019
27f796f
Update CI test config
de-sh Feb 25, 2019
db7ed35
Add missing import
de-sh Mar 2, 2019
bf3e397
Fixing requirements
gustavodemorais Mar 2, 2019
a1f74ba
Porting hydraspec to hydra_python_Core
gustavodemorais Mar 2, 2019
9cd8c18
Fixing typos in import
gustavodemorais Mar 2, 2019
c7a7aba
Adding import hydra_python_core
gustavodemorais Mar 2, 2019
6b95957
Adding some virtualenv folders and build packages
gustavodemorais Mar 2, 2019
c760223
Setting Redis version as 2 because of breaking change in Redis 3
gustavodemorais Mar 2, 2019
29808b3
Changing test due to hydraspec port to hydra_python_core
gustavodemorais Mar 2, 2019
d7a4348
Removed completely the dependency of hydrus
gustavodemorais Mar 2, 2019
b952f19
Merge pull request #87 from de-sh/develop
xadahiya Mar 3, 2019
cc35df2
Updating gitignore to add virtualenv and built packages dirs
gustavodemorais Mar 3, 2019
fb18d31
Setting Redis version as 2 because of breaking change in Redis 3
gustavodemorais Mar 3, 2019
442bfed
Merge remote-tracking branch 'Guttz/develop' into develop
gustavodemorais Mar 3, 2019
f0caf17
Merge pull request #89 from Guttz/develop
xadahiya Mar 4, 2019
6c7562f
Corrected logger format. Improved URL processing (#90)
shravandoda Mar 6, 2019
b29b5df
Fix input stripping (#75)
PrajwalM2212 Mar 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ celerybeat-schedule
.venv
venv/
ENV/
share
include
bin

# pipenv generated filespip
Pipfile
Pipfile.lock

# Spyder project settings
.spyderproject
Expand All @@ -99,3 +106,6 @@ ENV/

# mypy
.mypy_cache/

#build packages
src
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ python:
- "3.6-dev" # 3.6 development branch
- "3.7-dev"
install:
- pip install -e git+https://github.com/HTTP-APIs/hydrus#egg=hydrus
- pip install -e git+https://github.com/HTTP-APIs/hydra-python-core#egg=hydra_python_core
- pip install -e .

script: python -m unittest discover
7 changes: 3 additions & 4 deletions hydra_agent/hydra_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from redisgraph import Graph, Node
import urllib.request
import json
from hydrus.hydraspec import doc_maker
import hydrus
from hydra_python_core import doc_maker, doc_writer
from graphviz import Digraph
from hydra_agent.classes_objects import ClassEndpoints,RequestError
from hydra_agent.collections_endpoint import CollectionEndpoints
Expand All @@ -21,12 +20,12 @@ def get_apistructure(self,entrypoint_node, api_doc):
for support_property in api_doc.entrypoint.entrypoint.supportedProperty:
if isinstance(
support_property,
hydrus.hydraspec.doc_writer.EntryPointClass):
doc_writer.EntryPointClass):
self.class_endpoints[support_property.name] = support_property.id_

if isinstance(
support_property,
hydrus.hydraspec.doc_writer.EntryPointCollection):
doc_writer.EntryPointCollection):
self.collection_endpoints[support_property.name] = support_property.id_

if len(self.class_endpoints.keys())>0:
Expand Down
24 changes: 13 additions & 11 deletions hydra_agent/querying_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import logging
from hydra_agent.hydra_graph import InitialGraph
import urllib.request
from urllib.parse import urljoin
import json
from hydrus.hydraspec import doc_maker
from hydra_python_core import doc_maker
from urllib.error import URLError, HTTPError
from hydra_agent.collections_endpoint import CollectionEndpoints
from hydra_agent.classes_objects import ClassEndpoints,RequestError
Expand All @@ -29,18 +30,17 @@ def load_data(self, url):
:return: loaded data
"""
try:
response = urllib.request.urlopen(url)
with urllib.request.urlopen(url) as response:
return json.loads(response.read().decode('utf-8'))
except HTTPError as e:
logger.info('Error code: ', e.code)
logger.error('Error Code: {}'.format(e.code))
return RequestError("error")
except URLError as e:
logger.info('Reason: ', e.reason)
logger.error('Reason: {}'.format(e.reason))
return RequestError("error")
except ValueError as e:
logger.info("value error:", e)
logger.error("Value Error: {}".format(e))
return RequestError("error")
else:
return json.loads(response.read().decode('utf-8'))

def show_data(self, get_data):
"""
Expand Down Expand Up @@ -658,7 +658,7 @@ def query(apidoc, url):

while True:
print("press exit to quit")
query = input(">>>")
query = input(">>>").strip()
if query == "exit":
break
elif query == "help":
Expand All @@ -672,7 +672,7 @@ def main():
Take URL as an input and make graph using initilize function.
:return: call query function for more query.
"""
url = input("url>>>")
url = input("url>>>").strip()
if url == "exit":
print("exit...")
return 0
Expand All @@ -681,11 +681,13 @@ def main():
while True:
if isinstance (apidoc, RequestError):
print("enter right url")
url = input("url>>>")
url = input("url>>>").strip()
if url == "exit":
print("exit...")
return 0
apidoc = handle_data.load_data(url + "/vocab")
url = url.rstrip('/') + '/'
url = urljoin(url, 'vocab')
apidoc = handle_data.load_data(url)
else:
break
return query(apidoc, url)
Expand Down
2 changes: 1 addition & 1 deletion redis_setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#It will check, if docker is not installed then install it.
docker -v
if [ echo "$?" = "127" ]
if [ "$?" = "127" ]
then
sudo apt-get update
sudo apt-get install docker
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rdflib
rdflib-jsonld
uritemplate
httplib2
redis
redis==2.10.6
redisgraph
graphviz
-e git+https://github.com/HTTP-APIs/hydrus.git#egg=hydrus
-e git+https://github.com/HTTP-APIs/hydra-python-core.git#egg=hydra_python_core