Re: Efficient SPARQL query for RDF collections

2020-12-15 Thread Andy Seaborne




On 15/12/2020 14:33, Mikael Pesonen wrote:


Hi,

I am querying subclasses of class (here id:365852007) which belongs to 
RDF collection like this


id:1 rdf:type owl:Class ;
     rdfs:subClassOf [ owl:intersectionOf ( ... id:365852007 ... ) ]  ;
     skos:prefLabel "something"@en .
id:2 rdf:type owl:Class ;
     rdfs:subClassOf [ owl:intersectionOf ( ... id:365852007 ... ) ]  ;
     skos:prefLabel "something else"@en .


... denotes random number of other elements in the list.

SPARQL:

select * where
{
     ?subclass rdfs:subClassOf [ owl:intersectionOf /rdf:rest*/rdf:first 
id:365852007  ] .

     ?subclass skos:prefLabel ?label .


Try breaking the pattern up:

?Z rdf:rest*/rdf:first id:365852007   .
?X owl:intersectionOf ?Z .
?subclass rdfs:subClassOf ?X .
?subclass rdfs:label ?label .

and use 3.17.0


}


This is slow (~10 secs) and we need to extend the query to subclasses of 
the subclasses and so on.


Is there any faster way to get this done?

Thanks!



Efficient SPARQL query for RDF collections

2020-12-15 Thread Mikael Pesonen


Hi,

I am querying subclasses of class (here id:365852007) which belongs to 
RDF collection like this


id:1 rdf:type owl:Class ;
    rdfs:subClassOf [ owl:intersectionOf ( ... id:365852007 ... ) ]  ;
    skos:prefLabel "something"@en .
id:2 rdf:type owl:Class ;
    rdfs:subClassOf [ owl:intersectionOf ( ... id:365852007 ... ) ]  ;
    skos:prefLabel "something else"@en .


... denotes random number of other elements in the list.

SPARQL:

select * where
{
    ?subclass rdfs:subClassOf [ owl:intersectionOf /rdf:rest*/rdf:first 
id:365852007  ] .

    ?subclass skos:prefLabel ?label .
}


This is slow (~10 secs) and we need to extend the query to subclasses of 
the subclasses and so on.


Is there any faster way to get this done?

Thanks!


Re: sparql problem

2020-12-15 Thread Andy Seaborne

Hi there,

> apache-jena-fuseki-3.5.0

That's quite old - the current version is 3.17.0
Upgrading would be a good idea just in case.

Are there any messages in the server log file?


It is going to be difficult to pin down an encoding issue (if that is 
what it is) because by the time we get this email, it has been 
encoded/decoded so many times it may have changed the data.


What displays correctly one way may actually be different bytes, but it 
is hidden by display reversing the mis-encoding.  This is especailly 
true for data displayed in web-browsers.


It is worth executing the queries from the command line with Fuseki running.

Looking at the UTF-8, the first and third queries look right.

Andy

Comments inline below:


On 15/12/2020 03:12, 周蓉 wrote:

Hello, when I query in Fuseki like this:

PREFIX : 

SELECT * WHERE {

   ?s ?p ?o.

} #query1

It can return the many results ,one of the results is:
:口腔毛滴虫病rdf:type:症状


when I query like this:
PREFIX : 
SELECT * WHERE {
   :口腔毛滴虫病 rdf:type ?o.
} #query2
it can return the results:
:症状


(That does not show a prefix for rdf: presumably the real query has that 
PREFIX in it?)


Could you try the query with



This eliminates one step - the prefix to URI conversion.




but when I query like this:
PREFIX : 
SELECT * WHERE {
   ?s rdf:type :症状.
} #query3
it returns:
No data available in table





it confused me again

is this the problem related to the OWL data in 
..\jena\apache-jena-fuseki-3.5.0\run\databases?

or RDF data in ..\jena\tdb


I would certainly check the data by dumping the database.
That is especially the the encoding of the URI 







look forward and thanks for your reply





  



Re: Update Jena from 3.16 to 3.17 : problem with Jackson, diverging version in another software

2020-12-15 Thread Jean-Marc Vanel
I feel that I'm cornered with this problem; so I threw a bottle in the sea:
https://stackoverflow.com/questions/65302371/playframework-cannot-override-sbt-dependency
but my forecast is that I will stay at Jena 3.16 until Play Framework
updates its Jackson dependencies .

Or someday I will quit Play Framework in favor of Akka, which is anyway the
underlying server of Play Framework.
I use very little of Play Framework; my XHTML templates are in plain Scala
XML.

Jean-Marc Vanel

+33
(0)6 89 16 29 52


Le lun. 14 déc. 2020 à 19:23, Jean-Marc Vanel  a
écrit :

> The exclude declarations looked in fact OK,
> because the jar for jackson-databind is (like jackson-core) in folder
> com.fasterxml.jackson.core , which is being excluded, e.g. in :
>
>   val jenaTextDependency = "org.apache.jena" % "jena-text" % jenaVersion
> excludeAll(
> ExclusionRule(organization = "*com.fasterxml.jackson.core*" ) ,
> ExclusionRule(organization = "com.fasterxml.jackson.datatype" ) ,
> ExclusionRule(organization = "com.fasterxml.jackson.module" )
>
> After that I tried a more radical SBT exclusion rule, excluding jackson
> transitively through all application modules:
>
> *excludeDependencies* ++= Seq(
>   ExclusionRule("com.fasterxml.jackson.core" ),
>   ExclusionRule(organization = "com.fasterxml.jackson.datatype" ) ,
>   ExclusionRule(organization = "com.fasterxml.jackson.module" )
> )
>
> which excludes everything under "com.fasterxml.jackson.*" for all
> dependencies :
>
> https://github.com/jmvanel/semantic_forms/blob/master/scala/project/Common.scala#L20
>
> NOTE: the exception is thrown by Akka : akka % akka-serialization-jackson
>
> [error] com.fasterxml.jackson.databind.JsonMappingException: Scala
> module 2.10.4 requires Jackson Databind version >= 2.10.0 and < 2.11.0
> [error] at
> com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:61)
> [error] at
> com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:46)
> [error] at
> com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:17)
> [error] at
> com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:819)
> [error] at
> akka.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4(JacksonObjectMapperProvider.scala:223)
> [error] at
> akka.serialization.jackson.JacksonObjectMapperProvider$.$anonfun$configureObjectMapperModules$4$adapted(JacksonObjectMapperProvider.scala:222)
> [error] at
> scala.collection.immutable.List.foreach(List.scala:431)
> [error] at akka.
> *serialization.jackson.JacksonObjectMapperProvider*
> $.configureObjectMapperModules(JacksonObjectMapperProvider.scala:222)
> ...
> [error] at akka.actor.ActorSystem$.apply(ActorSystem.scala:290)
> [error] at play.core.server.*DevServerStart*
> $.$anonfun$mainDev$1(DevServerStart.scala:248)
> [error] at
> play.utils.Threads$.withContextClassLoader(Threads.scala:22)
> [error] at
> play.core.server.DevServerStart$.mainDev(DevServerStart.scala:76)
>
>
> I guess I will ask to Play community ...
>
> Jean-Marc Vanel
> 
>  +33
> (0)6 89 16 29 52
>
>
> Le lun. 14 déc. 2020 à 15:36, Andy Seaborne  a écrit :
>
>>
>>
>> On 14/12/2020 13:12, Jean-Marc Vanel wrote:
>> > A found a cleaner way with SBT build engine to exclude all Jackson stuff
>> > coming from Jena :
>> >
>> https://github.com/jmvanel/semantic_forms/blob/2b5bfb31a47376f86cfbb7f2820be1dbeada1a8b/scala/project/Common.scala#L21
>> >
>> > But this does not fix the problem "JsonMappingException: Scala module
>> > 2.10.4 requires Jackson Databind version >= 2.10.0 and < 2.11.0 " .
>>
>> databind != datatype
>>
>> Jena includes:
>> com.fasterxml.jackson.core:jackson-core:jar:2.12.0:compile
>> com.fasterxml.jackson.core:jackson-databind:jar:2.12.0:compile
>>
>> >
>> > I failed to find other dependencies that would bring Jackson 2.11.3 .
>> > So either the SBT exclusion attempt does not work, or there is some
>> other
>> > dependency bringing Jackson 2.11.3  ( Akka ? ) .
>> >
>> > Jean-Marc Vanel
>> > <
>> http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
>> >
>> > +33
>> > (0)6 89 16 29 52
>> >
>> >
>> > Le sam. 12 déc. 2020 à 15:16, Andy Seaborne  a écrit :
>> >
>> >>
>> >>
>> >> On 11/12/2020 16:26, Jean-Marc Vanel wrote:
>> >>> I use latest Play Framework 2.8.5 with Scala (my project is
>> >>> https://github.com/jmvanel/semantic_forms). I try to upgrade my Jena
>> >>> dependency from 3.16.0 to 3.17.0 .
>> >>> I get this message when running:
>> >>> [error] com.fasterxml.jackson.databind.JsonMappingException: *Scala
>> >> module
>> >>> 2.10.4 requires Jac