-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project 2-SPARQL library #16
base: main
Are you sure you want to change the base?
Conversation
HAVING (COUNT(?instance) = 0) | ||
|
||
Purpose: This query retrieves all classes that do not have any instances associated with them. | ||
It uses FILTER NOT EXISTS to ensure that only classes without any defined instances are selected,helping to identify potentially unused or unnecessary classes in the ontology. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where?
WHERE { | ||
?instance a ?class1 . | ||
?instance a ?class2 . | ||
?class1 owl:disjointWith ?class2 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose you have a class A that is asserted in the OWL file to be owl:disjointWith itself. Suppose it has an instance a. This query would return: A, A, a. This is problematic and should be detected, but not for the motivation of this query.
This suggests to me you should assert ?class1 =/ ?class2 and have a separate query that identifies as errors classes asserted to be disjoint with themselves.
|
||
# Identify their common superclass | ||
?class1 rdfs:subClassOf ?commonSuperclass . | ||
?class2 rdfs:subClassOf ?commonSuperclass . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, the classes could be the same as discussed above.
Second, I'm not sure how this query does what you describe, since it's unclear what standards are being leveraged in evaluation.
?class a owl:Class . | ||
|
||
# Retrieve the first property-definition pair for the class | ||
?class ?property1 ?definition1 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to leverage the specific annotation property used in CCO for definitions to narrow the focus of your query. Everything with a ? preceding it is a variable and so by default ranges over everything that might match its position in the triple.
# Selecting all classes in CCO | ||
?class a owl:Class . | ||
|
||
# Retrieve the first sub-property of the class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to know much more about what you take this query to be doing...
11. Identifying Classes Without Labels (Level 4 - 10 points) | ||
|
||
Title: Missing Class Label Detection | ||
Constraint Description: Identifies classes that lack human-readable labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you think this is worth 10 points?
This query seeks to surface classes that lack human-readable labels. | ||
Labels are vital for enabling users to understand the ontology’s structure, and their absence may hamper usability. | ||
|
||
12. Detecting Missing Annotations (Labels or Comments) (Level 4 - 10 points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all CCO elements have comments?
Constraint Description: Identifies properties used by instances of multiple classes. | ||
Severity: Warning | ||
|
||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compare this against the following and report back the results:
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
SELECT DISTINCT ?property ?class1 ?class2
WHERE {
?property a rdf:Property .
?instance1 a ?class1 .
?instance1 ?property ?value .
?instance2 a ?class2 .
?instance2 ?property ?value .
FILTER(?class1 != ?class2)
}
Constraint Description: Detects inconsistencies in property ranges within class hierarchies. | ||
Severity: Error | ||
|
||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, certainly not worth 20 points.
Second, compare and report back the results:
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX owl: http://www.w3.org/2002/07/owl#
SELECT DISTINCT ?property ?class1 ?range1 ?class2 ?range2
WHERE {
?property a rdf:Property .
?class1 ?property ?value1 .
?value1 a ?range1 .
?class2 rdfs:subClassOf ?class1 .
?class2 ?property ?value2 .
?value2 a ?range2 .
FILTER(?range1 != ?range2)
}
This assignment outlines a series of SPARQL queries designed for evaluating and analyzing ontology structure and quality. Each query addresses specific aspects of ontology evaluation, identifying potential issues or improvements necessary to enhance clarity and consistency.