Questions tagged [owlready]

Owlready is a module for ontology-oriented programming in Python, including an optimized RDF quadstore.

Owlready can:

  • Import OWL 2.0 ontologies in NTriples, RDF/XML or OWL/XML format.
  • Export OWL 2.0 ontologies to NTriples or RDF/XML.
  • Manipulates ontology classes, instances and properties transparently, as if they were normal Python objects.
  • Add Python methods to ontology classes.
  • Perform automatic classification of classes and instances, using the HermiT reasoner.
122 questions
2
votes
2 answers

Creating Owlready2 properties dynamically

I am in need of creating an ontology dynamically. for classes I am creating them using below method. with onto: NewClass = types.new_class(class_name, tuple(SuperClasses)) But for creating properties(object/data etc..) I am unable to find a way…
Zenmate
  • 41
  • 4
2
votes
1 answer

owlready2 reasoner does not generate inferred object property assertions with a SWRL rule

Suppose an OWL ontology contains the following SWRL rule: has_part(?x, ?y) ^ participates(?x, ?z) -> participates(?y, ?z) and following object property assertions: o1 has_part o2 o1 participates p1 When I run the Hermit reasoner in Protege, I…
HMCheong
  • 79
  • 1
  • 7
2
votes
2 answers

Creating an instance in OWLready2 creates a completely new class instead of asigning it to the existing class

I'm trying to create a simple ontology, following the tutorial on the official website. The code runs smoothly and everything seems fine when running this code: import owlready2 owlready2.JAVA_EXE = r"my-path-to-java-exe" # new.owl is a…
mathbbandstuff
  • 215
  • 1
  • 5
2
votes
0 answers

owlready2 rdfs:subClassOf inference doesn't work

I created an rdflib graph and serialised it into an owl file formatted as XML. I explicitly write A RDF.type RDFS.Class and B RDFS.subClassOf A. After I do this. onto =…
lamename
  • 31
  • 2
2
votes
1 answer

IndexError: list index out of range ontology annotation

I am adding annotation to ontology using following code from owlready import * onto = get_ontology("C://Users//sharm//Documents//ISWC2020//Ontology_read_play//Covid_v1.owl") ANNOTATIONS[Thing].add_annotation("comment", "My…
2
votes
1 answer

SWRL rules comparing individuals from two (2) classes

I have a simple ontology with different classes, which courses and lessons are classes. I'm trying to run a SWRL rule that associates a property belongsTo to individuals of the lessons. I'm using OWLReady2 and Python with onto: #courses …
TheSoldier
  • 484
  • 1
  • 5
  • 25
2
votes
1 answer

Successfully installed OWLready2, but get an error while using it

As mentioned in the title, I have updated "Python" and "pip" to their last versions, also successfully installed the "owlready2" library, but when using it in the code below: from owlready2 import * onto_path.append("path to onto in my local…
RFAI
  • 459
  • 4
  • 17
2
votes
0 answers

How to inspect a class?

I am trying to understand how to inspect python3 classes. In the following example, onto.search_one returns an object of class owlready2.entity.ThingClass. But help() shows the class as class BTO_0000007(EFO_0001643, EFO_0002888). Why there is such…
user1424739
  • 11,937
  • 17
  • 63
  • 152
2
votes
1 answer

Owlready2 dynamic class generation

I am trying to dynamically create a class for an owlready2 ontology. The documentation suggests the following line of code: NewClass = types.new_class("NewClassName", (SuperClass,), kwds = { "namespace" : my_ontology }) In my case this…
enigma
  • 493
  • 2
  • 5
  • 18
2
votes
1 answer

Installing development version of a module in python

I am trying to install the development version of owlready2; I take the following step; Extracted the development version downloaded from https://bitbucket.org/jibalamy/owlready2/downloads/ uninstalled previously installed owlready versions went…
Muhammad
  • 305
  • 2
  • 6
  • 20
2
votes
1 answer

Is there any way to convert OWL/RDF to OWL/XML FILE?

I want to use owlready.But is there any way to convert my ontology OWL/RDF file to OWL/XML? or Is there any python library which can we used to OWL/RDF file?
1
vote
0 answers

Filtering the text in SPARQL query based on the language using owlready2

I have an ontology in an 'owl' file (quran_data_full.owl) and I saved it in a folder in my google drive (Quran Corpus). To perform some queries in this ontology, first I tried the query on Apache Jena Fuseki. It gave me the correct results so I…
Reem
  • 107
  • 1
  • 7
1
vote
1 answer

Running SPARQL query using owlready2 gave ValueError: Unknown block type MinusBlock

I have an ontology in an 'owl' file (quran_data_full.owl) and I saved it in a folder in my google drive (Quran Corpus). To perform some queries in this ontology, first I tried the query on Apache Jena Fuseki. It gave me the correct results so I…
Reem
  • 107
  • 1
  • 7
1
vote
1 answer

Add new Individuals to an existing ontology from a dataframe using owlready 2

I have the following dataframe: import pandas as pd data = [['onto.modify', 'onto.ModificationAction1']] df = pd.DataFrame(data, columns=['queries', 'corpus']) queries corpus 0 onto.modify …
xavi
  • 80
  • 1
  • 12
1
vote
0 answers

Owlready2: importing in-memory rdflib graph

I have an ontology that defines a subject area, and have used that to help construct an rdflib graph of object instances, and their interrelating properties. I'm using python, owlready2 and rdflib libraries. I had tried constructing the instances…
Thomas Kimber
  • 10,601
  • 3
  • 25
  • 42
1
2
3
8 9