Timing was accurate, I was statement stepping in the Eclipse debugger. But 
adding the prepare will isolate where the overhead is occurring.


-----Original Message-----
From: Rob Vesse [mailto:[email protected]] 
Sent: Monday, April 01, 2013 12:45 PM
To: [email protected]
Subject: Re: performance of createIndividual with OntModel

It is entirely possible that your timing is inaccurate because you have not 
accounted for the preparation time of the OntModel


An OntModel does not do any reasoning until it has to, the first thing that 
triggers reasoning can make what might be a normally fast operation appear very 
slow.  This is particularly true when your OntModel is over a SDB backed model 
since this may result in many small database calls.

After you create your OntModel call prepare() on it and time this separately 
from your createIndividual() or other calls.

Hope this helps,

Rob


On 4/1/13 8:34 AM, "David Jordan" <[email protected]> wrote:

>
>I am getting a performance result of around 1 minute clock time to 
>execute OntClass.createIndividual. Is this expected? Below is the 
>relevant part of the ontology and the Java code. Every line of code 
>runs fast except the createIndividual. Is this due to reasoning being 
>kicked off for the first time? I’ll see if adding a second individual 
>is just as slow.
>
>veh:numWheels a   owl:DatatypeProperty ;
>      rdfs:domain veh:Vehicle ;
>      rdfs:range xsd:integer .
>
>veh:Vehicle
>      a       owl:Class ;
>      rdfs:subClassOf
>              [ a       owl:Restriction ;
>                owl:maxCardinality """1
>                        """^^xsd:nonNegativeInteger ;
>                owl:onProperty veh:numWheels
>              ] .
>
>veh:Motorcycle
>      a       owl:Class ;
>      rdfs:subClassOf veh:Vehicle ;
>      owl:equivalentClass
>              [ a       owl:Restriction ;
>                owl:hasValue "2"^^xsd:nonNegativeInteger ;
>                owl:onProperty veh:numWheels
>              ] .
>
>
>Here is the Java code.
>
>Model model = getNamedModel(VEHICLE_MODEL_NAME);
>OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_DL_MEM_RULE_INF);
>OntModel omodel = ModelFactory.createOntologyModel(spec, model); 
>OntClass bikeClass = omodel.getOntClass(uriBase + "Motorcycle"); 
>Individual myBike = bikeClass.createIndividual(uriBase + 
>"data/myBike");
>
>This is with latest SDB and Postgres.
>Is there anything in the ontology causing the slowdown?
>
>David Jordan
>Senior Software Developer
>SAS Institute Inc.
>Health & Life Sciences, Research & Development Bldg R ▪ Office 4467
>600 Research Drive ▪ Cary, NC 27513
>Tel: 919 531 1233 ▪ [email protected]<mailto:[email protected]>
>www.sas.com<http://www.sas.com/>
>SAS® … THE POWER TO KNOW®
>

Reply via email to