-
Notifications
You must be signed in to change notification settings - Fork 74
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
create skeleton for adding indirect existentials in materialize #1215
Draft
souzadevinicius
wants to merge
1
commit into
ontodev:master
Choose a base branch
from
souzadevinicius:issue-1213-indirect
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0"?> | ||
<rdf:RDF xmlns="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2/" | ||
xml:base="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2/" | ||
xmlns:owl="http://www.w3.org/2002/07/owl#" | ||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:xml="http://www.w3.org/XML/1998/namespace" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" | ||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> | ||
<owl:Ontology rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2"/> | ||
|
||
|
||
|
||
<!-- | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Object Properties | ||
// | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
--> | ||
|
||
|
||
|
||
|
||
<!-- http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#has_part --> | ||
|
||
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#has_part"> | ||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/> | ||
</owl:ObjectProperty> | ||
|
||
|
||
|
||
<!-- | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Classes | ||
// | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
--> | ||
|
||
|
||
|
||
|
||
<!-- http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#car --> | ||
|
||
<owl:Class rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#car"> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#has_part"/> | ||
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#wheel"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
</owl:Class> | ||
|
||
|
||
|
||
<!-- http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#convertible --> | ||
|
||
<owl:Class rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#convertible"> | ||
<rdfs:subClassOf rdf:resource="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#car"/> | ||
</owl:Class> | ||
|
||
|
||
|
||
<!-- http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#hubcap --> | ||
|
||
<owl:Class rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#hubcap"/> | ||
|
||
|
||
|
||
<!-- http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#wheel --> | ||
|
||
<owl:Class rdf:about="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#wheel"> | ||
<rdfs:subClassOf> | ||
<owl:Restriction> | ||
<owl:onProperty rdf:resource="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#has_part"/> | ||
<owl:someValuesFrom rdf:resource="http://www.semanticweb.org/vinicius/ontologies/2024/7/untitled-ontology-2#hubcap"/> | ||
</owl:Restriction> | ||
</rdfs:subClassOf> | ||
</owl:Class> | ||
</rdf:RDF> | ||
|
||
|
||
|
||
<!-- Generated by the OWL API (version 4.5.29.2024-05-13T12:11:03Z) https://github.com/owlcs/owlapi --> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ public MaterializeCommand() { | |
o.addOption("o", "output", true, "save reasoned ontology to a file"); | ||
o.addOption("t", "term", true, "a property to materialize"); | ||
o.addOption("T", "term-file", true, "load properties from a file"); | ||
o.addOption( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. option should be "false" by default |
||
"c", "include-indirect", true, "if true include redundant existential restrictions"); | ||
options = o; | ||
} | ||
|
||
|
@@ -131,6 +133,8 @@ public CommandState execute(CommandState state, String[] args) throws Exception | |
} | ||
} | ||
|
||
boolean includeIndirect = CommandLineHelper.getBooleanValue(line, "include-indirect", false); | ||
|
||
Set<IRI> terms = CommandLineHelper.getTerms(ioHelper, line, true); | ||
Set<OWLObjectProperty> properties = new HashSet<>(); | ||
for (IRI term : terms) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ public static void materialize( | |
* @param options A map of options for the operation | ||
* @param reasonOverImportsClosure if true will first perform materialization over all ontologies | ||
* in the import closure | ||
* @param includeIndirect if true include redundant existential restrictions | ||
* @throws OWLOntologyCreationException on ontology problem | ||
* @throws OntologyLogicException on logic problem | ||
*/ | ||
|
@@ -87,12 +88,37 @@ public static void materialize( | |
Map<String, String> options, | ||
boolean reasonOverImportsClosure) | ||
throws OntologyLogicException, OWLOntologyCreationException { | ||
materialize(ontology, reasonerFactory, properties, options, reasonOverImportsClosure, false); | ||
} | ||
|
||
/** | ||
* Replace EquivalentClass axioms with weaker SubClassOf axioms. | ||
* | ||
* @param ontology The OWLOntology to relax | ||
* @param reasonerFactory reasoner factory for the reasoner that is to be wrapped | ||
* @param properties object properties whose existentials are to be materialized (null | ||
* materializes all) | ||
* @param options A map of options for the operation | ||
* @param reasonOverImportsClosure if true will first perform materialization over all ontologies | ||
* in the import closure | ||
* @throws OWLOntologyCreationException on ontology problem | ||
* @throws OntologyLogicException on logic problem | ||
*/ | ||
public static void materialize( | ||
OWLOntology ontology, | ||
OWLReasonerFactory reasonerFactory, | ||
Set<OWLObjectProperty> properties, | ||
Map<String, String> options, | ||
boolean reasonOverImportsClosure, | ||
boolean includeIndirect) | ||
throws OntologyLogicException, OWLOntologyCreationException { | ||
|
||
if (reasonOverImportsClosure) { | ||
logger.info("Materializing imported ontologies..."); | ||
for (OWLOntology importedOntology : ontology.getImportsClosure()) { | ||
if (!importedOntology.equals(ontology)) { | ||
materialize(importedOntology, reasonerFactory, properties, options, false); | ||
materialize( | ||
importedOntology, reasonerFactory, properties, options, false, includeIndirect); | ||
} | ||
} | ||
} | ||
|
@@ -143,7 +169,7 @@ public static void materialize( | |
logger.debug("Excluding classes not in main ontology: " + c); | ||
continue; | ||
} | ||
Set<OWLClassExpression> sces = emr.getSuperClassExpressions(c, true); | ||
Set<OWLClassExpression> sces = emr.getSuperClassExpressions(c, !includeIndirect); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (!emr.isSatisfiable(c)) { | ||
logger.error("Ontology is not coherent! Unsatisfiable: " + c); | ||
throw new IncoherentTBoxException(Collections.singleton(c)); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These are very ugly IRIs, maybe run a string replace on the file to replace
with something like