Skip to content
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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

elenamiliv
Copy link

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.

  1. Detect Properties Without Domain or Range (level 8 - 0 points)
  2. Identifying Disjoint Classes with Common Instances (level 7 - 2 points)
  3. Detecting Unused Object Properties (level 7 - 2 points)
  4. Finding Classes with Conflicting Disjointness and Subclass Relationships (level 6 - 3 points)
  5. Identifying Classes with Different Labeling Standards (level 6 - 3 points)
  6. Identifying Potentially Overspecified Class Definitions (level 5 - 5 points)
  7. Detecting Equivalent Properties with Different Ranges (level 5 - 5 points)
  8. Analyzing Class Hierarchies for Inconsistent Type Definitions (level 5 - 5 points)
  9. Detecting Potentially Misplaced Inverse Object Properties (level 5 - 5 points)
  10. Identifying Classes with No Properties (Level 4 - 10 points)
  11. Identifying Classes Without Labels (Level 4 - 10 points)
  12. Query to Detect Missing Annotations (Labels or Comments) Level 4 - 10 points
  13. Detecting Properties Shared Across Multiple CCO Classes Level 3 - 20 points
  14. Detecting Inconsistent Property Ranges Across Subclass Hierarchies Level 3 - 20 points

@elenamiliv elenamiliv closed this Oct 2, 2024
@elenamiliv elenamiliv reopened this Oct 2, 2024
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.
Copy link
Contributor

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 .
Copy link
Contributor

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 .
Copy link
Contributor

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 .
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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)
Copy link
Contributor

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#>
Copy link
Contributor

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#>
Copy link
Contributor

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants