From users-return-18264-archive-asf-public=cust-asf.ponee.io@jena.apache.org Sun Apr 8 11:22:11 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 64250180638 for ; Sun, 8 Apr 2018 11:22:11 +0200 (CEST) Received: (qmail 94834 invoked by uid 500); 8 Apr 2018 09:22:10 -0000 Mailing-List: contact users-help@jena.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jena.apache.org Delivered-To: mailing list users@jena.apache.org Received: (qmail 94814 invoked by uid 99); 8 Apr 2018 09:22:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Apr 2018 09:22:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id DA40B18048A for ; Sun, 8 Apr 2018 09:22:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.12 X-Spam-Level: X-Spam-Status: No, score=-0.12 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_SHORT=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id M5uMwfqWEqDS for ; Sun, 8 Apr 2018 09:22:07 +0000 (UTC) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 26CC75F490 for ; Sun, 8 Apr 2018 09:22:07 +0000 (UTC) Received: by mail-wm0-f47.google.com with SMTP id i3so10050307wmf.3 for ; Sun, 08 Apr 2018 02:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=t3t3Bk4sQ1TD1isc7sHOP4W39RBM/4W14qeEi13KRHA=; b=pNrnUHrm6FCh+EnAajqBlqgsxp9j0iS5GTZv/9rbXgXqpV3x/i7ae+RR2CbbZpW7vJ z60WutEDibMerIbiYpDNjssYXL2TS0qkfusQEZ6KwiX60aBNLFYkNHjLCXwleh4GXw2M AOjoINbAKwJAzxSt+bEogy/bMsPoYiB7zLwVVrz5cjHbHqHn6kHvkhL4sYzl5a9jWZMp /rgTpM32JUcWvYN6Trm/wnVSGPRg4WImOZx403lYhVh+xaggduFq4uxqwLNqdREt4Mpa xXLjfrnEcgtUzpF5WxFAOD6vSHjetGFSB37/ZmrjPg23/LsnZKoEAHPgwpWaLMrEfFLi LySg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=t3t3Bk4sQ1TD1isc7sHOP4W39RBM/4W14qeEi13KRHA=; b=W0+EiFdB91YAEiUtGwt+Tlz6Ntob/Mr3bY0KnmrrflEVedVssWOirYN9f2NjEvpVoS 62qgcAUsulm6HB2FgxKhxlPLj58baQyLS/WdtrkhilsJ01pnOdRBDzajJH4yXqw9giib xgU7HX3A8yZCa94mYsTlqb+RYJKUZle9AyNT5kvxM/ggP6hl4la5RAPOccrsibtCoweQ wT9A8znMukpqdIinvp1kbDUM7O87QX5ZpXfMcoY8go5Ugiv4mXZYdnW877N/SIYh75VI bVCkqYCLMG2ALEf/Jx2PpZCI1oJn3v47vcHwmtBltDlrg8LxzFMOaAKJNGJHmZvt0dyJ ytnQ== X-Gm-Message-State: ALQs6tCJRFXr3bO9GYdZZvkiYz0PVWP2m9FrdgBNNCehdCEipOQjowHp Iky9M4tHYxTSO4xdwSO7fI1LSigF X-Google-Smtp-Source: AIpwx49te5aRHi1fMRNrtqBcgY2Bj3mEjd0RIYiFDS+gjZH6sdTh+o8Rlxr6Cy6RWKkpRAvmTdGBrA== X-Received: by 10.80.142.174 with SMTP id w43mr15714684edw.140.1523179320860; Sun, 08 Apr 2018 02:22:00 -0700 (PDT) Received: from [192.168.1.64] ([88.97.99.208]) by smtp.gmail.com with ESMTPSA id h16sm8911546edj.10.2018.04.08.02.22.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 02:22:00 -0700 (PDT) Subject: Re: Clearing and reloading ontology and its imports To: users@jena.apache.org References: From: Dave Reynolds Message-ID: Date: Sun, 8 Apr 2018 10:21:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit On 07/04/18 10:49, Martynas Jusevičius wrote: > Sorry for the noise, it looks like the listImportedOntologyURIs() was a red > herring -- the submodel count actually comes from InfModel which includes > the schema submodels. > > > But I was able to dig a little further, and observed after the code I have > shown is executed, there are inconsistencies in models for the same > ontology but accessed in different ways: > > ontology.getOntModel().getOntology(" > https://localhost:4443/demo/iswc-2017/ns/templates# > ").listImports().toList().toString() > > [http://atomgraph.com/ns/platform/templates#, > https://www.w3.org/ns/ldt/core/templates#] > > > ontology.getOntModel().getDocumentManager().getOntology(" > https://localhost:4443/demo/iswc-2017/ns/templates#", > org.apache.jena.ontology.OntModelSpec.OWL_MEM).getOntology(" > https://localhost:4443/demo/iswc-2017/ns/templates# > ").listImports().toList().toString() > > [https://www.w3.org/ns/ldt/core/templates#] > > > Notice how imports for > https://localhost:4443/demo/iswc-2017/ns/templates# differ. > How is that possible, and how do I avoid this? No idea but since the first example has some inference enabled that might be a clue. Do you have a complete minimal example of an ontology which exhibits this difference? Dave > On Fri, Apr 6, 2018 at 3:19 PM, Martynas Jusevičius > wrote: > >> I guess dynamic imports is what I need. But will they get triggered if I >> remove and then re-add the whole Model (as shown in my example), rather >> than statements? >> >> I could probably removeAll() statements from it instead of removing it >> from cache. >> >> On Fri, Apr 6, 2018 at 1:59 PM, Martynas Jusevičius < >> martynas@atomgraph.com> wrote: >> >>> Hi, >>> >>> we have an ontology editor that stores ontologies and their terms in a >>> triplestore. On the other end, they are being loaded by OntDocumentManager. >>> >>> The question is: what is the proper way to clear and reload an ontology >>> and its imports in OntDocumentManager? >>> >>> Because, for example, a user could totally change owl:imports statements >>> of an ontology, and we need this feature to be able to reload a completely >>> new OntModel without any old imported submodels. >>> >>> Right now I'm simply doing the following: >>> >>> OntDocumentManager.getInstance().getFileManager(). >>> removeCacheModel(ontologyURI) >>> OntDocumentManager.getInstance().addModel(ontologyURI, infModel); >>> OntModel ontModel = OntDocumentManager.getInstance().getOntology(ontologyURI, >>> ontModelSpec); >>> >>> But this is not enough, because doing ontModel.listImportedOntologyURIs() >>> lists all the old imports from before. >>> >>> Am I getting this right and what needs to be done to reload the imports >>> as well? >>> >>> I can see there is a concept of dynamic imports in OntModel, but not sure >>> it's related. >>> >>> >>> Martynas >>> >> >> >