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

WIP: Early draft owlet query expansion #1139

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

WIP: Early draft owlet query expansion #1139

wants to merge 8 commits into from

Conversation

matentzn
Copy link
Contributor

@matentzn matentzn commented Aug 6, 2023

Resolves #387

  • docs/ have been added/updated
  • tests have been added/updated
  • mvn verify says all tests pass
  • mvn site says all JavaDocs correct
  • CHANGELOG.md has been updated

WIP.

At the moment I am trying to use Owlet in query preprocessing. There are too many errors I need some more experienced coder to help me with. For example, I am unable to install the required jena libs for Owlet

Could not resolve dependencies for project org.obolibrary.robot:robot-core:jar:1.10.0-SNAPSHOT: Could not find artifact org.apache.jena:apache-jena-libs:jar:4.8.0 in central (https://repo.maven.apache.org/maven2)

But this is not all, I still need to see how I can leverage Owlet for ROBOT template validation.

robot-core/pom.xml Outdated Show resolved Hide resolved
robot-core/pom.xml Outdated Show resolved Hide resolved
@matentzn
Copy link
Contributor Author

matentzn commented Aug 8, 2023

@balhoff - have you tried building this branch?

No matter what I try, I still get:

[ERROR] Failed to execute goal on project robot-core: Could not resolve dependencies for project org.obolibrary.robot:robot-core:jar:1.10.0-SNAPSHOT: Could not find artifact org.apache.jena:apache-jena-libs:jar:4.1.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project robot-core: Could not resolve dependencies for project org.obolibrary.robot:robot-core:jar:1.10.0-SNAPSHOT: Could not find artifact org.apache.jena:apache-jena-libs:jar:4.1.0 in central (https://repo.maven.apache.org/maven2)

@balhoff balhoff self-requested a review September 9, 2023 15:55
@balhoff
Copy link
Contributor

balhoff commented Sep 9, 2023

@matentzn this should build now.

@matentzn
Copy link
Contributor Author

@balhoff this is a bit pushed back now, due to other priorities, but thanks a ton for sorting this out, will get to it!

@matentzn matentzn self-assigned this Sep 29, 2023
Copy link
Contributor

@gouttegd gouttegd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s the status on this? I would love to see this landing in ROBOT.

*
* @author <a href="mailto:[email protected]">Nicolas Matentzoglu</a>
*/
public class DLQueryCommand implements Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command is defined but never added to the CommandManager.


List<List<String>> queries = getQueries(line);
for (List<String> q : queries) {
queryOntology(q, ontology, reasonerFactory, selects);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As implemented, it is very inefficient to run several queries against the same ontology, because there is no shared state between each query (in particular, no shared reasoner, even though the ontology cannot possibly change between each query, so initialising a brand new reasoner instance for each query is pointless).

From some tests I did with Uberon:

  • running a single query takes ~11s;
  • running 2 queries (--query "query 1" output1.txt --query "query 2" output2.txt) takes ~19s;
  • running 3 queries takes ~27s;
  • and so on.

By contrast, with a modified version that uses a shared state:

  • running a single query takes ~11s;
  • running 2 queries takes ~11.2s;
  • running 3 queries takes ~11.4s;
  • and so on.

ManchesterOWLSyntaxClassExpressionParser parser =
new ManchesterOWLSyntaxClassExpressionParser(
ontology.getOWLOntologyManager().getOWLDataFactory(),
new ShortFormEntityChecker(shortFormProvider));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I missed something, this doesn’t allow to do what is advertised in the documentation (using labels to refer to classes and relations). This only allows to use CURIEs, and it doesn’t even work with OBO-style CURIEs.

You’d rather want to use a QuotedEntityChecker here:

QuotedEntityChecker qec = new QuotedEntityChecker();
qec.addProperty(ontology.getOWLOntologyManager().getOWLDataFactory().getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()));
// Optionally also allow to use `oboInOwl:shorthand`, so that one can use e.g. `part_of` instead of `'part of'`
qec.addAll(ontology);

@matentzn
Copy link
Contributor Author

@gouttegd I will never get to this now (I had some funding which since ran out and I cant take on coding tasks atm), but feel free to gut this PR of finish it: its yours if you want it :)

@gouttegd
Copy link
Contributor

I will consider finish it.

Ultimately I want something to replace OWLTools’s --reasoner-query ... --make-ontology-from-results, and this could be a good starting point.

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.

Support DL query
3 participants