You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Ashwani Rathi <as...@oracle.com> on 2020/07/30 14:42:35 UTC

Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Hi,
We are upgrading Jena from version 2.8.8 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
        {
            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);
                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

Because of these missing classes,  we are running in to issues.
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?
Do we need to use some other createOntologyModel api in Jena 3 or need to do it some other way?
Kindly respond

Regards,
Ashwani



Re: Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Posted by Andy Seaborne <an...@apache.org>.

On 03/08/2020 13:55, Ashwani Rathi wrote:
> Hi Andy,
> I tried removing 'file:', but that didn't work.
> I also tried adding a http:// but that didn't work either.

Have you checked what the java resource name is for 
"businessArchitectureOntology.owl"?

> 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?

The suggestion is have a URI for the "<owl:imports rdf:resource=" and a 
rename in a location mapper - see below.

Factors like whether there is a non-default OntDocumentManager will matter.

I'd suggest writing a small tests case to get things working. There are 
quite a few details here.

(Not sure why you want businessArchitectureOntology.owl in a jar - seems 
to make things complicated.)

This works:

---- owl.rdf
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	 xmlns:owl="http://www.w3.org/2002/07/owl#"
    >

   <owl:Ontology>
     <owl:imports rdf:resource="http://ex/ont.owl"/>
   </owl:Ontology>

</rdf:RDF>


---- src/main/resources/data-ont.ttl
----   (so it is on the classpath as "data-ont.ttl")
PREFIX : <http://example/>

:DATA :PREDICATE 123456789 .



---- Code
public static void main(String...a) {
         OntModel example = 
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);

	// Add a rename.
         example.getDocumentManager()
             .getFileManager()
             .getLocationMapper()
             .addAltEntry("http://ex/ont.owl", "data-ont.ttl");

         // Load
         example.read("owl.rdf");
	// Print
         example.writeAll(System.out, "TTL");
         System.out.println("DONE");
         System.exit(0);





> 
> 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" <an...@apache.org> 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" <an...@apache.org> 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
>      >
>      >
>      >
>      
> 
> 

Re: Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Posted by Ashwani Rathi <as...@oracle.com>.
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" <an...@apache.org> 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" <an...@apache.org> 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
    >      
    > 
    > 
    



Re: Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Posted by Andy Seaborne <an...@apache.org>.

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://jena.apache.org/documentation/notes/stream-manager.html

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" <an...@apache.org> 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
>      
> 
> 

Re: Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Posted by Ashwani Rathi <as...@oracle.com>.
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?

Regards,
Ashwani


On 31/07/20, 1:13 PM, "Andy Seaborne" <an...@apache.org> 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
    



Re: Jena 2 to Jena 3 upgrade -> Issue in createOntologyModel method

Posted by Andy Seaborne <an...@apache.org>.

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