Re: Ontology URI vs document URI

2022-03-26 Thread Martynas Jusevičius
It doesn't look like the ReadHook is applied on the cache key, unfortunately.

The problematic OntDocumentManager code is here:
https://github.com/apache/jena/blob/main/jena-core/src/main/java/org/apache/jena/ontology/OntDocumentManager.java#L983

On Sat, Mar 26, 2022 at 5:09 PM Martynas Jusevičius
 wrote:
>
> Could OntDocumentManager.ReadHook be used for this?
> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/OntDocumentManager.ReadHook.html
>
> On Sat, Mar 26, 2022 at 4:46 PM Martynas Jusevičius
>  wrote:
> >
> > Hi,
> >
> > Using the ontology API, if one owl:imports an ontology URI such as
> >  into ontology model, the imported model
> > gets cached under the "http://www.w3.org/ns/org#; key.
> >
> > However, given
> >
> >  a owl:Ontology
> >
> > one can argue that this URI is of the ontology resource, but what gets
> > loaded and cached is more than that -- it is the ontology *document*.
> > This relates to the old debate whether ontology instances should
> > contain the trailing # in their URIs, i.e. whether ontology and its
> > document is the same resource or distinct resources.
> >
> > The problem is that despite the ontology being cached, code that
> > attempts to dereference its document URI will not be able to make use
> > of it as "http://www.w3.org/ns/org; will not match the
> > "http://www.w3.org/ns/org#; cache key.
> >
> > My questions are:
> > 1. How can I work around this? Using some kind of post-loadImports()
> > hook to make cache entries for both URIs?
> > 2. Shouldn't the OWL import code be aware of this and cache the
> > document URI while using it as a base for all relative URIs (of
> > ontology terms)?
> >
> > Martynas
> > atomgraph.com


Re: Ontology URI vs document URI

2022-03-26 Thread Martynas Jusevičius
Could OntDocumentManager.ReadHook be used for this?
https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/OntDocumentManager.ReadHook.html

On Sat, Mar 26, 2022 at 4:46 PM Martynas Jusevičius
 wrote:
>
> Hi,
>
> Using the ontology API, if one owl:imports an ontology URI such as
>  into ontology model, the imported model
> gets cached under the "http://www.w3.org/ns/org#; key.
>
> However, given
>
>  a owl:Ontology
>
> one can argue that this URI is of the ontology resource, but what gets
> loaded and cached is more than that -- it is the ontology *document*.
> This relates to the old debate whether ontology instances should
> contain the trailing # in their URIs, i.e. whether ontology and its
> document is the same resource or distinct resources.
>
> The problem is that despite the ontology being cached, code that
> attempts to dereference its document URI will not be able to make use
> of it as "http://www.w3.org/ns/org; will not match the
> "http://www.w3.org/ns/org#; cache key.
>
> My questions are:
> 1. How can I work around this? Using some kind of post-loadImports()
> hook to make cache entries for both URIs?
> 2. Shouldn't the OWL import code be aware of this and cache the
> document URI while using it as a base for all relative URIs (of
> ontology terms)?
>
> Martynas
> atomgraph.com


Ontology URI vs document URI

2022-03-26 Thread Martynas Jusevičius
Hi,

Using the ontology API, if one owl:imports an ontology URI such as
 into ontology model, the imported model
gets cached under the "http://www.w3.org/ns/org#; key.

However, given

 a owl:Ontology

one can argue that this URI is of the ontology resource, but what gets
loaded and cached is more than that -- it is the ontology *document*.
This relates to the old debate whether ontology instances should
contain the trailing # in their URIs, i.e. whether ontology and its
document is the same resource or distinct resources.

The problem is that despite the ontology being cached, code that
attempts to dereference its document URI will not be able to make use
of it as "http://www.w3.org/ns/org; will not match the
"http://www.w3.org/ns/org#; cache key.

My questions are:
1. How can I work around this? Using some kind of post-loadImports()
hook to make cache entries for both URIs?
2. Shouldn't the OWL import code be aware of this and cache the
document URI while using it as a base for all relative URIs (of
ontology terms)?

Martynas
atomgraph.com


Re: Safe delete & insert with Fuseki

2022-03-26 Thread Andy Seaborne



If you put all the changes in one update request, they will be done 
atomically.


DELETE { ... } WHERE { ... }
;
INSERT DATA { ... }

Also, the WHERE clause in a DELETE-INSERT-WHERE can be used to "switch 
off" an operation.


Andy

On 24/03/2022 13:17, Mikael Pesonen wrote:


We have occasionally an issue with replace where inserting new data may 
fail after old data has been deleted. What is the recommended way to do 
this kind of multipart SPARQL with Fuseki (not java)? First option comes 
to mind is to test if SPARQL insert is correct and WOULD be executed. Is 
this possible?