diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.gitignore b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.name b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.name new file mode 100644 index 0000000000000000000000000000000000000000..b63a982a293e403f295a7932d832545d1986f54a --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/.name @@ -0,0 +1 @@ +CanisCare_Backend \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/CanisCare_Backend.iml b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/CanisCare_Backend.iml new file mode 100644 index 0000000000000000000000000000000000000000..dde40f1fda980833c746e0e8988f6dc23aab53a4 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/CanisCare_Backend.iml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="PYTHON_MODULE" version="4"> + <component name="FacetManager"> + <facet type="django" name="Django"> + <configuration> + <option name="rootFolder" value="$MODULE_DIR$" /> + <option name="settingsModule" value="djangoProject/settings.py" /> + <option name="manageScript" value="$MODULE_DIR$/manage.py" /> + <option name="environment" value="<map/>" /> + <option name="doNotUseTestRunner" value="false" /> + <option name="trackFilePattern" value="migrations" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/venv" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> + <component name="TemplatesService"> + <option name="TEMPLATE_CONFIGURATION" value="Django" /> + <option name="TEMPLATE_FOLDERS"> + <list> + <option value="$MODULE_DIR$/../djangoProject\templates" /> + </list> + </option> + </component> +</module> \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/Project_Default.xml b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..3dce9c67a3cba33789d113124d53150ccca2370b --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <option name="ignoredErrors"> + <list> + <option value="N806" /> + </list> + </option> + </inspection_tool> + </profile> +</component> \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/profiles_settings.xml b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="USE_PROJECT_PROFILE" value="false" /> + <version value="1.0" /> + </settings> +</component> \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/misc.xml b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..6a481572556951573e97ea081b4af8038017415f --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/misc.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (djangoProject)" project-jdk-type="Python SDK" /> +</project> \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/.idea/modules.xml b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..18ef9dc14d02f7d7a0287fc13322aca2a6f7be3a --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/CanisCare_Backend.iml" filepath="$PROJECT_DIR$/.idea/CanisCare_Backend.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__init__.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/__init__.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7bb85ad5fa210573bc4ed50e308727fcb4775a28 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/__init__.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/admin.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/admin.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7f06130b71aaccedc090f01b06453b97956d949 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/admin.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/apps.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce6018e1c3cf7b017ff67a3cdeb544a5dcbc1992 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/apps.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/models.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6651949c12521ecf52cadd1aea9b3a32381de5eb Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/models.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/serializers.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/serializers.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0237248626dd4849092875a6209c9633c11a6e84 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/serializers.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/urls.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86946cddacb77c876cd47eed1cd6aba6948909fc Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/urls.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/views.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/views.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a03effdbdd6fa5f84772f8c4a937d392da221eda Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/__pycache__/views.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/admin.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/admin.py new file mode 100644 index 0000000000000000000000000000000000000000..8f968037e2aeaae3a0d6179e0d6f36a258d22611 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import Note + +admin.site.register(Note) diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/apps.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/apps.py new file mode 100644 index 0000000000000000000000000000000000000000..66656fd29b2cc651c92dc03b2eaf6ef9a4397df0 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ApiConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'api' diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/0001_initial.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/0001_initial.py new file mode 100644 index 0000000000000000000000000000000000000000..86dd139ce66167aebec6d19c2d1c8aa9ca88f827 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 4.1 on 2022-08-25 06:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Note', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('body', models.TextField()), + ('updated', models.DateTimeField(auto_now=True)), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + 'ordering': ['-updated'], + }, + ), + ] diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__init__.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/0001_initial.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/0001_initial.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cbffbae7c3b0f171a1a28355db34bde795fc47d6 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/__init__.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17c3ea51fd69206050b5cceb18bb22e00e09253f Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/api/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/models.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/models.py new file mode 100644 index 0000000000000000000000000000000000000000..af725acb2ac6b1936993f82d4a539a0ff92418d1 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/models.py @@ -0,0 +1,13 @@ +from django.db import models + + +class Note(models.Model): + body = models.TextField() + updated = models.DateTimeField(auto_now=True) + created = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.body[0:50] + + class Meta: + ordering = ['-updated'] diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/serializers.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/serializers.py new file mode 100644 index 0000000000000000000000000000000000000000..8c8a585e3b44b5ca4c60bb08032df078c592d4aa --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/serializers.py @@ -0,0 +1,8 @@ +from rest_framework.serializers import ModelSerializer +from .models import Note + + +class NoteSerializer(ModelSerializer): + class Meta: + model = Note + fields = '__all__' diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/tests.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/urls.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..353e0ba7613e7e6a0f934a270c5be493cf6bb27f --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/urls.py @@ -0,0 +1,17 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.getRoutes), + path('notes/', views.getNotes), + path('diseases/', views.get_diseases), + path('disease/<str:pk>/', views.get_disease_description), + path('disease/<str:pk>/<str:pk2>/', views.get_disease_sub), + path('disease/<str:pk>/<str:pk2>/<str:pk3>/', views.get_disease_sub_info), + path('notes/create/', views.createNote), + path('disease/treatment/', views.get_treatment), + path('notes/<str:pk>/update/', views.updateNote), + path('notes/<str:pk>/delete/', views.deleteNote), + path('notes/<str:pk>/', views.getNote), + +] diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/api/views.py b/Ontology_Based_Information_System/Canis_Care_Backend/api/views.py new file mode 100644 index 0000000000000000000000000000000000000000..907eba5a6993eef2909e47b25290defda7893350 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/api/views.py @@ -0,0 +1,213 @@ +from rest_framework.decorators import api_view +from rest_framework.response import Response +from .serializers import NoteSerializer +from .models import Note +from owlready2 import * +from rdflib import * + +# onto = get_ontology("C:\\Users\\LENOVO\\Desktop\\dogSkinDisease.owl").load(reload_if_newer = True) +# onto = get_ontology( +# "C:\\Users\\LENOVO\\Music\\Ontology Generation\\Ontology generation\\Fourth\\Ontology with uppercase disease " +# "name\\dogDisease.owl" +# ).load( +# reload_if_newer=True) +onto = get_ontology("C:\\Users\\LENOVO\\PycharmProjects\\buildOntology\\dogDisease.owl").load(reload_if_newer=True) +graph = default_world.as_rdflib_graph() + + +@api_view(['GET']) +def getRoutes(request): + routes = [ + { + 'EndPoint': '/notes/', + 'method': 'GET', + 'body': None, + 'description': 'Returns an array of notes' + }, + { + 'EndPoint': '/notes/id', + 'method': 'GET', + 'body': None, + 'description': 'Returns an array of notes' + }, + { + 'EndPoint': '/decease/treatment/', + 'method': 'POST', + 'body': {'decease': ""}, + 'description': 'Get treatments for the decease' + }, + { + 'EndPoint': '/notes/id/update/', + 'method': 'PUT', + 'body': {'body': ""}, + 'description': 'Updates an existing record with data sent in put request' + }, + { + 'EndPoint': '/notes/id/delete', + 'method': 'DELETE', + 'body': None, + 'description': 'Deletes any existing note' + } + ] + return Response(routes) + + +@api_view(['GET']) +def getNotes(request): + notes = Note.objects.all() + serializer = NoteSerializer(notes, many=True) + + return Response(serializer.data) + + +@api_view(['GET']) +def getNote(request, pk): + notes = Note.objects.get(id=pk) + serializer = NoteSerializer(notes, many=False) + return Response(serializer.data) + + +@api_view(['GET']) +def get_disease_description(request, pk): + disease_description = list(graph.query( + """ + SELECT ?description + WHERE { ?disease <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#NamedDisease>; + FILTER(?disease = <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogDisease.owl#"""+pk+""">). + ?disease <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#hasDescription> ?description. + }""" + )) + + new_disease_description = [str(x[0]) for x in disease_description] + new_disease_description = ' '.join(new_disease_description) + new_disease_description = new_disease_description.split('.') + new_disease_description = new_disease_description[1:-1] + print(new_disease_description) + + return Response(new_disease_description) + + +@api_view(['GET']) +def get_disease_sub_info(request, pk, pk2, pk3): + global sci_name + + new_pk2 = pk2[:-1] + if pk == "Dandruff": + sci_name = "seborrheic dermatitis" + elif pk == "Ringworm": + sci_name = "dermatophytes" + elif pk == "YeastInfection": + sci_name = "Malassezia pachydermatitis" + + sub_list_info = list(graph.query( + """ + SELECT ?treatdescribe + WHERE { ?disease <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#NamedDisease>; + FILTER((?disease = <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogDisease.owl#""" + pk + """>) && (?treat = <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogDisease.owl#""" + pk3 + """>)). + ?disease <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#has""" + new_pk2 + """> ?treat. + ?treat <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#has""" + new_pk2 + """Description> ?treatdescribe. + }""")) + + new_sub_list_info = [str(x[0]) for x in sub_list_info] + new_sub_list_info = ' '.join(new_sub_list_info) + new_sub_list_info = new_sub_list_info.split('.') + new_sub_list_info = new_sub_list_info[1:-1] + print(new_sub_list_info) + + return Response(new_sub_list_info) + + +@api_view(['GET']) +def get_disease_sub(request, pk, pk2): + new_pk2 = pk2[:-1] + + sub_list = list(graph.query( + """ + SELECT ?treat + WHERE { ?disease <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#NamedDisease>; + FILTER(?disease = <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogDisease.owl#""" + pk + """>). + ?disease <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#has""" + new_pk2 + """> ?treat. + }""")) + + new_sub_list = [str(x[0]) for x in sub_list] + fin_sub_list = [] + + for y in new_sub_list: + itm = y[y.find('#'):][1:] + fin_sub_list.append(itm) + + return Response(new_sub_list) + + +@api_view(['GET']) +def get_diseases(request): + des_list = list(graph.query(""" + SELECT ?disease + WHERE { + ?disease <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#NamedDisease> . + }""")) + new_des_list = [str(x[0]) for x in des_list] + # index = [] + # for y in range(len(new_list)): + # index.append(y + 1) + # + # print(index) + # disease_dict = dict.fromkeys(new_list, "disease") + # index_dict = dict.fromkeys(index, "id") + # d1 = dict(enumerate(new_list)) + # print(disease_dict) + # print(index_dict) + fin_des_list = [] + + for y in new_des_list: + des = y[y.find('#'):][1:] + fin_des_list.append(des) + + print(fin_des_list) + return Response(fin_des_list) + + +@api_view(['POST']) +def get_treatment(request): + data = request.data + disease = data['disease'] + res = list(graph.query(""" + SELECT ?disease ?treat ?treatdescribe + WHERE { ?disease <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#hasScientificName> ?o; + FILTER(REGEX(?o, \"""" + disease + """\", "i")). + ?disease <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#hasTreatment> ?treat. + ?treat <http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogSkinDisease#hasTreatmentDescription> ?treatdescribe. + }""")) + return Response(res) + + +@api_view(['PUT']) +def updateNote(request, pk): + data = request.data + + note = Note.objects.get(id=pk) + serializer = NoteSerializer(note, data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data) + + +@api_view(['POST']) +def createNote(request): + data = request.data + + note = Note.objects.create( + body=data['body'] + ) + serializer = NoteSerializer(note, many=False) + + return Response(serializer.data) + + +@api_view(['DELETE']) +def deleteNote(request, pk): + data = request.data + + note = Note.objects.get(id=pk) + note.delete() + return Response("Note has been deleted!") diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/db.sqlite3 b/Ontology_Based_Information_System/Canis_Care_Backend/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..c64f75aa9cc76ec5697e2d34160d0d28f5a07430 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/db.sqlite3 differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__init__.py b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/__init__.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed1d111cc0c60db15399dacf98ef5877402f1eb7 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/__init__.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/settings.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e3061b8794abfdfa25bd23e544901e6f0bb9768 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/settings.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/urls.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf77f7ff9c8e2d51afdcb8f5516ad0aaed97b807 Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/urls.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/wsgi.cpython-310.pyc b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/wsgi.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b7eb80589430315a5cc18a901fd498b852c49ba Binary files /dev/null and b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/__pycache__/wsgi.cpython-310.pyc differ diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/asgi.py b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/asgi.py new file mode 100644 index 0000000000000000000000000000000000000000..a452a34276828ccd7693d93b48702c34c2d2dc54 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for djangoProject project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings') + +application = get_asgi_application() diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/settings.py b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/settings.py new file mode 100644 index 0000000000000000000000000000000000000000..77e15279b234d7b7c531aedf69700092166d74d4 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/settings.py @@ -0,0 +1,130 @@ +""" +Django settings for djangoProject project. + +Generated by 'django-admin startproject' using Django 4.1. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-3ts!3sf#jntwaa-9r(^t%7ty=nc03p_eil3yha%#hinc30b&ww' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['192.168.1.102', '192.168.1.101', '192.168.1.5', '192.168.1.100'] + +# Application definition + + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'api.apps.ApiConfig', + + 'rest_framework', + + 'corsheaders' +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + + "corsheaders.middleware.CorsMiddleware", + + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'djangoProject.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'] + , + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'djangoProject.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + +# Password validation +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/4.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +CORS_ALLOW_ALL_ORIGINS = True diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/urls.py b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..50312f4a377980c284d8ada6ff48a64fb499d50b --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import path,include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('api.urls')) +] diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/wsgi.py b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..eca644f26a76eb59ac1edeaec8589a22d5340133 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/djangoProject/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for djangoProject project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings') + +application = get_wsgi_application() diff --git a/Ontology_Based_Information_System/Canis_Care_Backend/manage.py b/Ontology_Based_Information_System/Canis_Care_Backend/manage.py new file mode 100644 index 0000000000000000000000000000000000000000..ee6d43581daddd89d802d7802a8477a9e0d4f363 --- /dev/null +++ b/Ontology_Based_Information_System/Canis_Care_Backend/manage.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys +from owlready2 import * + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings') + + # onto = get_ontology("C:\\Users\\LENOVO\\Documents\\Research\\dogSkinDisease.owl").load() + # + # default_world.set_backend(filename="disease.sqlite3") + + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main()