Cellfie API: impossible to create OWLEditorKit object?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Cellfie API: impossible to create OWLEditorKit object?

elijahFTL
As I posted in a previous thread, my goal is to write a program which takes 3 file paths as input (template ontology, instances CSV, rules JSON) and creates an instantiated ontology based on the input (but with no user input besides these paths).

As has been suggested before, the Cellfie API is not strictly required to do this. Mapping Master contains all the required tools. However, it is not at all clear to me how to put these tools together. I can get myself to the point where I have a properly-instantiated OWLRenderer and TransformationRuleSet, but what to do from there is a complete and total mystery.

Thus, my next idea was to simply look for code in which someone else has already "put it all together" for me: Cellfie. It looks like what I want is broadly contained in the GenerateAxiomsAction class, which requires a WorkspacePanel object, which requires an OWLEditorKit. This is where my problems begin. As far as I can tell, there is literally no way for me to create this object. It has one constructor (taking OWLEditorKitFactory as an argument), and whenever I call said constructor with a fresh OWLEditorKitFactory (or use the factory method for generating an editor kit, which just calls the same constructor anyway), I get a NullPointerException with the following stack trace:

at org.osgi.util.tracker.ServiceTracker.<init>(ServiceTracker.java:200)
        at org.protege.editor.core.plugin.PluginUtilities.getExtensionRegistry(PluginUtilities.java:99)
        at org.protege.editor.core.plugin.PluginExtensionFilter.getExtensions(PluginExtensionFilter.java:61)
        at org.protege.editor.core.plugin.AbstractPluginLoader.getPlugins(AbstractPluginLoader.java:59)
        at org.protege.editor.owl.model.library.OntologyCatalogManager.<init>(OntologyCatalogManager.java:77)
        at org.protege.editor.owl.model.OWLModelManagerImpl.<init>(OWLModelManagerImpl.java:110)
        at org.protege.editor.owl.OWLEditorKit.initialise(OWLEditorKit.java:89)
        at org.protege.editor.core.editorkit.AbstractEditorKit.<init>(AbstractEditorKit.java:33)
        at org.protege.editor.owl.OWLEditorKit.<init>(OWLEditorKit.java:82)

While this thread has been given a Cellfie-specific name, I will also welcome any posts that suggest how to accomplish what I want using just Mapping Master, although I suspect that it would involve rewriting a lot of code Cellfie already has.
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Martin O'Connor-2

To clarify: are you trying to produce a Protege plugin or would be happy with standalone code?

If you do not need to produce a plugin you can strip out all the OSGi malarkey.

(In my experience OSGi produces nothing but trouble - though is unfortunately needed in the case of a Protege plugin.)

In either case, I would first try to get the code working standalone and then move on from there.

Martin

> On Jun 28, 2017, at 1:18 PM, elijahFTL <[hidden email]> wrote:
>
> As I posted in a previous thread, my goal is to write a program which takes 3
> file paths as input (template ontology, instances CSV, rules JSON) and
> creates an instantiated ontology based on the input (but with no user input
> besides these paths).
>
> As has been suggested before, the Cellfie API is not strictly required to do
> this. Mapping Master contains all the required tools. However, it is not at
> all clear to me how to put these tools together. I can get myself to the
> point where I have a properly-instantiated OWLRenderer and
> TransformationRuleSet, but what to do from there is a complete and total
> mystery.
>
> Thus, my next idea was to simply look for code in which someone else has
> already "put it all together" for me: Cellfie. It looks like what I want is
> broadly contained in the GenerateAxiomsAction class, which requires a
> WorkspacePanel object, which requires an OWLEditorKit. This is where my
> problems begin. As far as I can tell, there is literally *no* way for me to
> create this object. It has one constructor (taking OWLEditorKitFactory as an
> argument), and whenever I call said constructor with a fresh
> OWLEditorKitFactory (or use the factory method for generating an editor kit,
> which just calls the same constructor anyway), I get a NullPointerException
> with the following stack trace:
>
> at org.osgi.util.tracker.ServiceTracker.<init>(ServiceTracker.java:200)
> at
> org.protege.editor.core.plugin.PluginUtilities.getExtensionRegistry(PluginUtilities.java:99)
> at
> org.protege.editor.core.plugin.PluginExtensionFilter.getExtensions(PluginExtensionFilter.java:61)
> at
> org.protege.editor.core.plugin.AbstractPluginLoader.getPlugins(AbstractPluginLoader.java:59)
> at
> org.protege.editor.owl.model.library.OntologyCatalogManager.<init>(OntologyCatalogManager.java:77)
> at
> org.protege.editor.owl.model.OWLModelManagerImpl.<init>(OWLModelManagerImpl.java:110)
> at org.protege.editor.owl.OWLEditorKit.initialise(OWLEditorKit.java:89)
> at
> org.protege.editor.core.editorkit.AbstractEditorKit.<init>(AbstractEditorKit.java:33)
> at org.protege.editor.owl.OWLEditorKit.<init>(OWLEditorKit.java:82)
>
> While this thread has been given a Cellfie-specific name, I will also
> welcome any posts that suggest how to accomplish what I want using just
> Mapping Master, although I suspect that it would involve rewriting a lot of
> code Cellfie already has.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/Cellfie-API-impossible-to-create-OWLEditorKit-object-tp4668975.html
> Sent from the Protege Developer mailing list archive at Nabble.com.
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev


_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

elijahFTL
Martin O'Connor-2 wrote
To clarify: are you trying to produce a Protege plugin or would be happy with standalone code?

If you do not need to produce a plugin you can strip out all the OSGi malarkey.

(In my experience OSGi produces nothing but trouble - though is unfortunately needed in the case of a Protege plugin.)

In either case, I would first try to get the code working standalone and then move on from there.

Martin
Standalone code is the goal. Stripping out the OSGi stuff seems pretty complicated, primarily because the lines referring to it are reasonably far down the dependency tree. I've been working at it for the last 2.5 hours or so with pretty much no luck. Here was my approach/plan:

1. Create new IntelliJ Java project (no Maven, because downloaded Maven source can't be edited)
2. Manually download and import (via POM) the Cellfie, Mapping Master, and Protege projects as separate modules
3. Delete all references to OSGi, preferably by deleting its Maven dependency and then erasing all the lines that cause compiler errors as a result of the newly-missing reference.

I did not get past step 2 because my code would not detect the imported modules unless the needed files were moved to my main module's directory. I started to (manually) move them as needed to fix compiler errors, but it quickly became clear this would take forever and might not even work.

My next idea was to start a new Maven project, manually paste the Cellfie, Mapping Master, and Protege sources into my new project's directory structure (making sure the directory structure's naming matched the packages), then just adding Maven dependencies for anything needed beyond that. I ran into a similar problem as before, finding myself manually adding an endless amount of Maven dependencies, as well as noticing some other compiler errors caused by classes I already imported, likely because I picked the wrong version by accident.

I imagine I'm overcomplicating this...
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Balhoff, James Patrick
Hi,

On Jun 29, 2017, at 10:55 AM, elijahFTL <[hidden email]> wrote:

I imagine I'm overcomplicating this...

I think depending on Protege for this task is making things more complicated than it needs to be. You could probably just use the OWL API, which is what Protege uses under the hood. One consideration though might be if you require functionality from Mapping Master for processing your template (I don’t know anything about Mapping Master). But for reading in data and generating OWL I would just write a program using OWL API.

We have a tool for generating OWL using design pattern templates (https://github.com/dosumis/dead_simple_owl_design_patterns), but I’m not sure whether it would meet all your requirements.

Best regards,
Jim


_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Martin O'Connor-2
In reply to this post by elijahFTL
1. Create new IntelliJ Java project (no Maven, because downloaded Maven
source can't be edited)

I don't fully follow this.I would concentrate on getting it working as a pure Maven project. And while IntelliJ is a great tool, it sometimes gets confused with Maven projects, specially when POMs are manually edited. I would remove that variable from the equation. 

You also should not use Cellfie as a dependency. As discussed, Mapping Master should be sufficient for your needs.

At the bottom of this file is a simple POM that imports Mapping Master that you can use as a baseline. 

Martin


2. Manually download and import (via POM) the Cellfie, Mapping Master, and
Protege projects as separate modules
3. Delete all references to OSGi, preferably by deleting its Maven
dependency and then erasing all the lines that cause compiler errors as a
result of the newly-missing reference.

I did not get past step 2 because my code would not detect the imported
modules unless the needed files were moved to my main module's directory. I
started to (manually) move them as needed to fix compiler errors, but it
quickly became clear this would take forever and might not even work.

My next idea was to start a new Maven project, manually paste the Cellfie,
Mapping Master, and Protege sources into my new project's directory
structure (making sure the directory structure's naming matched the
packages), then just adding Maven dependencies for anything needed beyond
that. I ran into a similar problem as before, finding myself manually adding
an endless amount of Maven dependencies, as well as noticing some other
compiler errors caused by classes I already imported, likely because I
picked the wrong version by accident.


<?xml version="1.0" encoding="utf-8"?>
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.mm</groupId>
  <artifactId>my-mm-app</artifactId>
  <version>1.0.0</version>
  <name>Mapping Master Integration Tests</name>
  <description>Integration tests for Mapping Master</description>

  <properties>

    <mapping-master.version>1.6</mapping-master.version>

    <maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version>

    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>

  <dependencies>

    <dependency>
      <groupId>edu.stanford.protege</groupId>
      <artifactId>mapping-master</artifactId>
      <version>${mapping-master.version}</version>
    </dependency>

  </dependencies>

  <build>

    <plugins>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>

    </plugins>

  </build>

</project>


_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

elijahFTL
Martin O'Connor-2 wrote
I don't fully follow this.I would concentrate on getting it working as a pure Maven project. And while IntelliJ is a great tool, it sometimes gets confused with Maven projects, specially when POMs are manually edited. I would remove that variable from the equation.

You also should not use Cellfie as a dependency. As discussed, Mapping Master should be sufficient for your needs.

At the bottom of this file is a simple POM that imports Mapping Master that you can use as a baseline.

Martin
Getting Mapping Master working on its own via Maven has been no issue whatsoever--all the errors/dependency problems I've described only occur when attempting to use Cellfie. The problem with that is more due to a lack of direction. Given an instantiated OWLRenderer and TransformationRuleSet, I cannot find any documentation that suggests what to do from there. Since I originally brought Cellfie into the environment with hopes of it saving me work, but found the opposite, it's pretty clear to me at this point that I should indeed scrap that idea. As such, it might be most appropriate for me to start a new thread about Mapping Master rather than Cellfie.
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Lorenz Buehmann
To sum up what all the others said and what was also suggested in the
previous thread:

Use OWL API + Mapping Master, both of which are standalone and don't
need a reference to Protege. An OWLRender is Protege code, isn't it? Why
do you need this? OWL API has all renderers contained in.


On 29.06.2017 18:29, elijahFTL wrote:

> Martin O'Connor-2 wrote
>> I don't fully follow this.I would concentrate on getting it working as a
>> pure Maven project. And while IntelliJ is a great tool, it sometimes gets
>> confused with Maven projects, specially when POMs are manually edited. I
>> would remove that variable from the equation.
>>
>> You also should not use Cellfie as a dependency. As discussed, Mapping
>> Master should be sufficient for your needs.
>>
>> At the bottom of this file is a simple POM that imports Mapping Master
>> that you can use as a baseline.
>>
>> Martin
> Getting Mapping Master working on its own via Maven has been no issue
> whatsoever--all the errors/dependency problems I've described only occur
> when attempting to use Cellfie. The problem with that is more due to a lack
> of direction. Given an instantiated OWLRenderer and TransformationRuleSet, I
> cannot find any documentation that suggests what to do from there. Since I
> originally brought Cellfie into the environment with hopes of it saving me
> work, but found the opposite, it's pretty clear to me at this point that I
> should indeed scrap that idea. As such, it might be most appropriate for me
> to start a new thread about Mapping Master rather than Cellfie.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/Cellfie-API-impossible-to-create-OWLEditorKit-object-tp4668975p4668987.html
> Sent from the Protege Developer mailing list archive at Nabble.com.
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

elijahFTL
The OWLRenderer class is part of org.mm.renderer.owlapi, and does not contain any Protege-related imports. So it's a Mapping Master class that relies on the OWL API, which I don't think there's much wrong with me using. The problem is that the method I'd imagine I'm meant to use, render(mmExpressionNode) takes an argument of type MMExpressionNode, which can only be created via an ASTMMExpression, which is in some way related to the MappingMasterParser class. At this point, I mostly just wish I had some documentation to look at, as I don't have much indication as to how the flow of data is supposed to work.

Lorenz B. wrote
To sum up what all the others said and what was also suggested in the
previous thread:

Use OWL API + Mapping Master, both of which are standalone and don't
need a reference to Protege. An OWLRender is Protege code, isn't it? Why
do you need this? OWL API has all renderers contained in.
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Lorenz Buehmann
This class is called OWLRendering - would be easier of understand if you
use the correct name, otherwise things are getting too confusing.


Anyhow, for me it's not clear why you need to import the Cellfie
project. Is there anything beyond the Mapping Master project that you need?


On 30.06.2017 14:35, elijahFTL wrote:

> The OWLRenderer class is part of org.mm.renderer.owlapi, and does not contain
> any Protege-related imports. So it's a Mapping Master class that relies on
> the OWL API, which I don't think there's much wrong with me using. The
> problem is that the method I'd imagine I'm meant to use,
> render(mmExpressionNode) takes an argument of type MMExpressionNode, which
> can only be created via an ASTMMExpression, which is in some way related to
> the MappingMasterParser class. At this point, I mostly just wish I had some
> documentation to look at, as I don't have much indication as to how the flow
> of data is supposed to work.
>
>
> Lorenz B. wrote
>> To sum up what all the others said and what was also suggested in the
>> previous thread:
>>
>> Use OWL API + Mapping Master, both of which are standalone and don't
>> need a reference to Protege. An OWLRender is Protege code, isn't it? Why
>> do you need this? OWL API has all renderers contained in.
>
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/Cellfie-API-impossible-to-create-OWLEditorKit-object-tp4668975p4668996.html
> Sent from the Protege Developer mailing list archive at Nabble.com.
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

elijahFTL
I'm not sure how OWLRendering came up, as I haven't ever mentioned or used it, only OWLRenderer. It would appear that the OWLRendering is the output of the OWLRenderer (which makes sense due to the naming). I would imagine that to take full advantage of Mapping Master, I would want to use its own Renderer (the OWLRenderer class) rather than obtain OWLRendering objects another way, but I'm open to being wrong about that.

I do not need to import the Cellfie project, I've since moved onto attempting a solution using only Mapping Master. I just thought that the Cellfie project might have contained some code that utilized Mapping Master in the same way I want to, but it looks to be more complicated than that.

Lorenz B. wrote
This class is called OWLRendering - would be easier of understand if you
use the correct name, otherwise things are getting too confusing.


Anyhow, for me it's not clear why you need to import the Cellfie
project. Is there anything beyond the Mapping Master project that you need?
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie API: impossible to create OWLEditorKit object?

Martin O'Connor-2

I will try to write a standalone Mapping Master example application and publish it in a GitHub repo (much like I have done with the SWRLAPI [1]).

Martin


On Jun 30, 2017, at 6:20 AM, elijahFTL <[hidden email]> wrote:

I'm not sure how OWLRendering came up, as I haven't ever mentioned or used
it, only OWLRenderer. It would appear that the OWLRendering is the output of
the OWLRenderer (which makes sense due to the naming). I would imagine that
to take full advantage of Mapping Master, I would want to use its own
Renderer (the OWLRenderer class) rather than obtain OWLRendering objects
another way, but I'm open to being wrong about that.

I do not need to import the Cellfie project, I've since moved onto
attempting a solution using only Mapping Master. I just thought that the
Cellfie project might have contained some code that utilized Mapping Master
in the same way I want to, but it looks to be more complicated than that.


Lorenz B. wrote
This class is called OWLRendering - would be easier of understand if you
use the correct name, otherwise things are getting too confusing.


Anyhow, for me it's not clear why you need to import the Cellfie
project. Is there anything beyond the Mapping Master project that you
need?





--
View this message in context: http://protege-project.136.n4.nabble.com/Cellfie-API-impossible-to-create-OWLEditorKit-object-tp4668975p4668998.html
Sent from the Protege Developer mailing list archive at Nabble.com.
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev


_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev