1

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 copied the query into my code in google collab but unfortunately it gave me an empty set.

This is my code in google collab:

from owlready2 import *
onto_path.append("/gdrive/MyDrive/Quran Corpus")
go = get_ontology("/gdrive/MyDrive/Quran Corpus/quran_data_full.owl").load()
obo = get_namespace("/gdrive/MyDrive/Quran Corpus/")
d = list(default_world.sparql("""
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX qur: <http://quranontology.com/Resource/>
SELECT ?verse ?text 
WHERE {?verse rdf:type qur:Verse.
?verse qur:DiscussTopic ?topic.
?verse rdfs:label ?text.
?topic qur:TopicCompleteName ?topicName.
FILTER (REGEX(STR(?topicName), "زكاة" ,"i")).
FILTER langMatches(lang(?text),"ar")
}
"""))

The issue in this line:

FILTER langMatches(lang(?text),"ar")

When I delete this line it gave me the correct results, however, it gave the text in both Arabic and English, but I want to show only the Arabic text.

enter image description here

How to filter the text based on the language in owlready2?

This is the result from running the query on Apache Jena Fuseki:

enter image description here

You can see the full content of quran_data_full.owl file here.

Reem
  • 107
  • 1
  • 7

0 Answers0