Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-226
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anuththara K.G.S.N
2022-226
Commits
1caf9779
Commit
1caf9779
authored
Sep 03, 2022
by
Wickramasinghe R.J.P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ontology generation script added
parent
3c8e482f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
Ontology_Based_Information_System/Ontology Generator/owl_generator.py
...ed_Information_System/Ontology Generator/owl_generator.py
+52
-0
No files found.
Ontology_Based_Information_System/Ontology Generator/owl_generator.py
0 → 100644
View file @
1caf9779
from
owlready2
import
*
import
csv
,
types
if
__name__
==
'__main__'
:
onto
=
get_ontology
(
"dogSkinDisease.owl"
)
.
load
()
onto_individuals
=
get_ontology
(
"http://www.semanticweb.org/dogdisease/ontologies/2022/4/dogDisease.owl"
)
onto_individuals
.
imported_ontologies
.
append
(
onto
)
f
=
open
(
"dogDisease.csv"
,
encoding
=
'utf-8'
)
reader
=
csv
.
reader
(
f
)
next
(
reader
)
with
onto_individuals
:
for
row
in
reader
:
Disease
,
DiseaseDescription
,
DiseaseCause
,
DiseaseCauseDescription
,
DiseaseDiagnose
,
DiseaseDiagnoseDescription
,
DiseasePrevention
,
DiseasePreventionDescription
,
DiseaseSymptoms
,
DiseaseSymptomsDescription
,
DiseaseTreatment
,
DiseaseTreatmentDescription
=
row
individual
=
onto
.
Disease
(
Disease
)
if
DiseaseDescription
:
individual
.
hasDescription
.
append
(
DiseaseDescription
)
if
DiseaseCause
:
diseaseCauseClass
=
onto
.
DiseaseCause
(
DiseaseCause
)
if
DiseaseCauseDescription
:
diseaseCauseClass
.
hasCasueDescription
.
append
(
DiseaseCauseDescription
)
individual
.
hasCause
.
append
(
diseaseCauseClass
)
if
DiseaseDiagnose
:
diseaseDiagnoseClass
=
onto
.
DiseaseDiagnose
(
DiseaseDiagnose
)
if
DiseaseDiagnoseDescription
:
diseaseDiagnoseClass
.
hasDiagnoseDescription
.
append
(
DiseaseDiagnoseDescription
)
individual
.
hasDiagnose
.
append
(
diseaseDiagnoseClass
)
if
DiseasePrevention
:
diseasePreventionClass
=
onto
.
DiseasePrevention
(
DiseasePrevention
)
if
DiseasePreventionDescription
:
diseasePreventionClass
.
hasPreventionDescription
.
append
(
DiseasePreventionDescription
)
individual
.
hasPrevention
.
append
(
diseasePreventionClass
)
if
DiseaseSymptoms
:
diseaseSymptomClass
=
onto
.
DiseaseSymptom
(
DiseaseSymptoms
)
if
DiseaseSymptomsDescription
:
diseaseSymptomClass
.
hasSymptomDescription
.
append
(
DiseaseSymptomsDescription
)
individual
.
hasSymptom
.
append
(
diseaseSymptomClass
)
if
DiseaseTreatment
:
diseaseTreatmentClass
=
onto
.
DiseaseTreatment
(
DiseaseTreatment
)
if
DiseaseTreatmentDescription
:
diseaseTreatmentClass
.
hasTreatmentDescription
.
append
(
DiseaseTreatmentDescription
)
individual
.
hasTreatment
.
append
(
diseaseTreatmentClass
)
onto_individuals
.
save
(
"dogDisease.owl"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment