Hi Andy,
I tried removing 'file:', but that didn't work.
I also tried adding a http:// but that didn't work either.
I can't use an absolute path as the imported owl file is contained in other jar
file.
I found something like org.apache.jena.util.FileManager.addLocatorZip(String
zfn) .. But didn't get any examples on how can we use a Zip locator to load an
owl file from another jar.
Can you please help on how can we add a Zip Locator to load owl from a jar
file? Or some other pointer that might help to address this issue?
Regards,
Ashwani
There is also use renaming - put a proper http:// above (or if you want
a file: with absolute path. The relative file path is making things
complicated.
https://urldefense.com/v3/__https://jena.apache.org/documentation/notes/stream-manager.html__;!!GqivPVa7Brio!P8xYoCIVAFctOvPeR-sdSBylcunyriAW29Zwuwh2l6H72p-2yTkkxADbPTP2XZsDQw$
RDFParser gives detail control if you don't want a global setup for
StreamManager.
Regards,
Ashwani
On 31/07/20, 8:04 PM, "Andy Seaborne" <[email protected]> wrote:
On 31/07/2020 14:22, Ashwani Rathi wrote:
> Hi Andy,
> I am able to find out the issue:
>
> In my OWL file, I am importing another owl like:
> <owl:imports
rdf:resource="file:metamodel/businessArchitectureOntology.owl"/>
>
> metamodel/businessArchitectureOntology.owl file is present in a jar file.
>
> This import used to work with Jena 2, but with Jena 3,
businessArchitectureOntology.owl is not getting loaded from the jar. I copied
this owl at a local location and updated the path and then it started working
in Jena 3 as well.
> So can you please let me know, how can I specify owl:imports in Jena 3 to
load a owl file from a jar that is present in classpath?
Probably - don't put "file:" on the front but relative URI resolution is
going to make thinds difficult.
There is also use renaming - put a proper http:// above (or if you want
a file: with absolute path. The relative file path is making things
complicated.
https://urldefense.com/v3/__https://jena.apache.org/documentation/notes/stream-manager.html__;!!GqivPVa7Brio!P8xYoCIVAFctOvPeR-sdSBylcunyriAW29Zwuwh2l6H72p-2yTkkxADbPTP2XZsDQw$
RDFParser gives detail control if you don't want a global setup for
StreamManager.
Andy
>
> Regards,
> Ashwani
>
>
> On 31/07/20, 1:13 PM, "Andy Seaborne" <[email protected]> wrote:
>
>
>
> On 30/07/2020 15:42, Ashwani Rathi wrote:
> > Hi,
> > We are upgrading Jena from version 2.8.8
>
> I think you mean ARQ-2.8.8 (2011-04-21), which is a pre-Apache
release.
> It uses jena 2.6.4 (2010-12-10) - sourceforge releases.
> License differences obviously.
>
> I don't believe there was a Jena 2.8.8, at least not an official one.
>
> At Apache, Jena releases start 2.7, or 2.9 for ARQ, then jump to 2.10
> (and that was 2013) to sync numbering.
>
> In summary - long time ago, big jump. Including RDF 1.0 to RDF 1.1
> (which affects string literals).
>
> > to the latest one available 3.16.0
> > Now we have the following code to initialize OntModel from a .owl
input file
> >
> > public static OntModel getOntModel()
> > throws BusinessArchitectureException
>
> How can this throw BusinessArchitectureException? Is this the real
code
> or an extract?
>
> > {
> > OntModel ontModel = null;
> > OntModelSpec s = new
OntModelSpec(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
> >
> > //FileManager fileMgr = FileManager.get(); // Used
for Jena 2
> > FileManager fileMgr = FileManagerImpl.get(); // Used
for Jena 3
> > try {
> > Model model =
fileMgr.loadModel(REPORTS_EXTENSION_OWL_FILE_PATH);
>
> No need to use "impl" classes:
>
> Model model =
RDFDataMgr.loadModel(REPORTS_EXTENSION_OWL_FILE_PATH);
>
> > ontModel = ModelFactory.createOntologyModel(s,
model);
> > }
> > catch (Exception e) {
> > e.printStackTrace();
> > }
> > return ontModel;
> > }
> >
> > This code when used in Jena 2 generated 235 OntClasses
(ontModel.listClasses()), but with Jena 3 it created only 23 OntClasses.
Difference is the classes like the following which are only generated while
using Jena 2:
> >
> > OntClass ----------- 74a1eaff:173a0249c84:-7f26
> > OntClass ----------- 74a1eaff:173a0249c84:-7ffb
>
> which are blank nodes.
>
> So, Jena3 only shows named classes?
> Does the file have the same number of triples when parsed with Jena2
as
> with Jena3?
>
> Have you tried bisecting on jena versions to see where the change
> happened? jena 2.7 and 2.10 onwards are in maven central so it is a
> matter of changing versions in a pom.xml/build.gradle file
>
> > Because of these missing classes, we are running in to issues.
>
> Which are?
>
> I ask because if it is because of a bug fix, then the application
code
> might be doing something strange.
>
> > So just wanted to check why are these extra ont classes not
getting generated with Jena 3 when we are using the same input file.
> > Has something changed in the api implementation?
>
> That seems to be a question that is probably about the data.
>
> Maybe something changed but in almost 10 years and no data to see it
is
> hard to know.
>
> > Do we need to use some other createOntologyModel api in Jena 3 or
need to do it some other way?
> > Kindly respond
> >
> > Regards,
> > Ashwani
>
> Andy
>
>
>