You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Federico López <fi...@gmail.com> on 2012/07/05 07:49:23 UTC

I need to get the root element of a ontology

I looking for a good quey that allows me to get the roots elements of a
Ontology. Also, I need to know wich one of these roots have children...


I have each ontology in a NAMED GRAPH....

This is what I using for it but the query is taking too much.

SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
FROM  <http://ontologyURI>
WHERE
{
 ?root a ?class .
 ?class rdfs:subClassOf owl:Class .
 ?root rdfs:label ?label .
 OPTIONAL {
 ?root rdfs:subClassOf ?super .
 }
 OPTIONAL {
 ?child rdfs:subClassOf ?root .
 }
 FILTER (!bound(?super))
}
GROUP BY ?root ?label

Any idea?

Thanks...


-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Milorad Tosic <mb...@yahoo.com>.
Great! Thanks for the good job done. Though, just in case, you got the equivalent results set, right?




>________________________________
> From: Federico López <fi...@gmail.com>
>To: users@jena.apache.org 
>Sent: Thursday, July 5, 2012 7:55 PM
>Subject: Re: I need to get the root element of a ontology
> 
>Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB of
>RAM... (Excuse my poor English)
>
>2012/7/5 Federico López <fi...@gmail.com>
>
>> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
>> 0.2.2) using with JUnit test.
>> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
>> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
>> takes 56.762s (even more)...
>>
>>
>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>
>>> On 05/07/12 18:30, Milorad Tosic wrote:
>>>
>>>> Would there by any differences in performance or eventually in result
>>>> set if we would substitute
>>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>> with
>>>>
>>>> MINUS { ?root rdfs:subClassOf ?super }
>>>> in the previous query?
>>>>
>>>> Milorad
>>>>
>>>
>>> Depends - also the required temporary memory needed is different.  The
>>> MINUS implement is quite performant now (previously it would have been
>>> the case the FILTER version was faster).
>>>
>>> The FILTER version streams - constant memory overhead.
>>>
>>> The MINUS version uses temporary RAM - in proportion to the size of the
>>> data matched.
>>>
>>> If there are a lot of rdfs:subClassOf, e.g. have expanded the inferences
>>> previous, it could be the MINUS version is slower.
>>>
>>> You'll have to try to be definitive.  If you try, do let us know.
>>>
>>>         Andy
>>>
>>>
>>>
>>>>
>>>>
>>>>  ______________________________**__
>>>>> From: Federico López <fi...@gmail.com>
>>>>> To: users@jena.apache.org
>>>>> Sent: Thursday, July 5, 2012 5:28 PM
>>>>> Subject: Re: I need to get the root element of a ontology
>>>>>
>>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>>>>
>>>>>  On 05/07/12 06:49, Federico López wrote:
>>>>>>
>>>>>>  I looking for a good quey that allows me to get the roots elements of
>>>>>>> a
>>>>>>> Ontology. Also, I need to know wich one of these roots have
>>>>>>> children...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  Version of Jena used?
>>>>>> I'm using fuseki 0.2.2...
>>>>>>
>>>>>>    I have each ontology in a NAMED GRAPH....
>>>>>>
>>>>>>>
>>>>>>>
>>>>>> And you are querying the union graph?
>>>>>>
>>>>>
>>>>>
>>>>> I'm Querying each GRAPH at time...
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>  This is what I using for it but the query is taking too much.
>>>>>>>
>>>>>>>
>>>>>> How big is the data (in triples)?
>>>>>>
>>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>>>>> triples),
>>>>> RadLex(234.442), ICD10(165.310)...
>>>>>
>>>>>
>>>>>> Are you using inference?
>>>>>>
>>>>>
>>>>> I don't....
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>>>>>> FROM  <http://ontologyURI>
>>>>>>> WHERE
>>>>>>> {
>>>>>>>     ?root a ?class .
>>>>>>>     ?class rdfs:subClassOf owl:Class .
>>>>>>>     ?root rdfs:label ?label .
>>>>>>>     OPTIONAL {
>>>>>>>     ?root rdfs:subClassOf ?super .
>>>>>>>     }
>>>>>>>     OPTIONAL {
>>>>>>>     ?child rdfs:subClassOf ?root .
>>>>>>>     }
>>>>>>>     FILTER (!bound(?super))
>>>>>>> }
>>>>>>> GROUP BY ?root ?label
>>>>>>>
>>>>>>> Any idea?
>>>>>>>
>>>>>>> Thanks...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  without inference, this maybe what you want: I'm guessing from your
>>>>>> description:
>>>>>>
>>>>>> SELECT ?root
>>>>>> {
>>>>>>     # A root is something that is of type class
>>>>>>     # which has no super class mentioned.
>>>>>>     ?root rdf:type owl:Class .
>>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>>
>>>>>>     ?root rdfs:label ?label .
>>>>>> }
>>>>>>
>>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>>>>>
>>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>>>>> {
>>>>>>     # A root is something that is of type class
>>>>>>     # which has no super class mentioned.
>>>>>>     ?root rdf:type owl:Class .
>>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>>
>>>>>>     ?root rdfs:label ?label .
>>>>>>     # Children, any depth, by property paths
>>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>>>>> }
>>>>>> GROUP BY ?root
>>>>>>           Andy
>>>>>>
>>>>>>
>>>>> And thanks, I going to try your query, but I think that is just that I
>>>>> need
>>>>> :D
>>>>>
>>>>> --
>>>>> *FEDERICO LÓPEZ GÓMEZ*
>>>>> Estudiante Ingeniería de Sistemas
>>>>> Universidad del Valle - Sede Tuluá
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>> --
>> *FEDERICO LÓPEZ GÓMEZ*
>> Estudiante Ingeniería de Sistemas
>> Universidad del Valle - Sede Tuluá
>>
>>
>
>
>-- 
>*FEDERICO LÓPEZ GÓMEZ*
>Estudiante Ingeniería de Sistemas
>Universidad del Valle - Sede Tuluá
>
>
>

Re: I need to get the root element of a ontology

Posted by Rob Vesse <rv...@yarcdata.com>.
Yes that would be correct, since the query is being executed within Fuseki
you need a version of Fuseki (0.2.3) that has ARQ 2.9.2 or higher in order
to get the MINUS improvements


The ARQ on the client side is just receiving the results from the SPARQL
endpoint

Rob

On 7/5/12 2:09 PM, "Federico López" <fi...@gmail.com> wrote:

>Well... Yes.. but I was using ARQ 2.9.2 in the client side and Fuseki
>0.2.2
>in the server side. I guess that the Fuseki 0.2.3 comes with a better
>version of MINUS.
>
>2012/7/5 Andy Seaborne <an...@apache.org>
>
>> On 05/07/12 21:57, Milorad Tosic wrote:
>>
>>> Would somebody please give us more details about what are dependencies
>>> between Fuseki and Jena/ARQ/TDB?
>>>
>>
>> That would be the POM files :-)
>>
>> http://repo1.maven.org/maven2/**org/apache/jena/jena-fuseki/0.**
>> 
>>2.2/jena-fuseki-0.2.2.pom<http://repo1.maven.org/maven2/org/apache/jena/j
>>ena-fuseki/0.2.2/jena-fuseki-0.2.2.pom>
>>
>> http://repo1.maven.org/maven2/**org/apache/jena/jena-fuseki/0.**
>> 
>>2.3/jena-fuseki-0.2.3.pom<http://repo1.maven.org/maven2/org/apache/jena/j
>>ena-fuseki/0.2.3/jena-fuseki-0.2.3.pom>
>>
>>
>> Fuseki 0.2.2 - ARQ 2.9.1 - Jena 2.7.1
>> Fuseki 0.2.3 - ARQ 2.9.2 - Jena 2.7.2
>>
>>         Andy
>>
>
>
>
>-- 
>*FEDERICO LÓPEZ GÓMEZ*
>Estudiante Ingeniería de Sistemas
>Universidad del Valle - Sede Tuluá


Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
Well... Yes.. but I was using ARQ 2.9.2 in the client side and Fuseki 0.2.2
in the server side. I guess that the Fuseki 0.2.3 comes with a better
version of MINUS.

2012/7/5 Andy Seaborne <an...@apache.org>

> On 05/07/12 21:57, Milorad Tosic wrote:
>
>> Would somebody please give us more details about what are dependencies
>> between Fuseki and Jena/ARQ/TDB?
>>
>
> That would be the POM files :-)
>
> http://repo1.maven.org/maven2/**org/apache/jena/jena-fuseki/0.**
> 2.2/jena-fuseki-0.2.2.pom<http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.2/jena-fuseki-0.2.2.pom>
>
> http://repo1.maven.org/maven2/**org/apache/jena/jena-fuseki/0.**
> 2.3/jena-fuseki-0.2.3.pom<http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.3/jena-fuseki-0.2.3.pom>
>
>
> Fuseki 0.2.2 - ARQ 2.9.1 - Jena 2.7.1
> Fuseki 0.2.3 - ARQ 2.9.2 - Jena 2.7.2
>
>         Andy
>



-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Stephen Allen <sa...@apache.org>.
It might be helpful to include all of the release notes (Jena, ARQ,
TDB) in the Fuseki binary distribution, as a lot of the improvements
occur there but are not immediately visible to people using just the
Fuseki distribution.

-Stephen

On Thu, Jul 5, 2012 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
> On 05/07/12 21:57, Milorad Tosic wrote:
>>
>> Would somebody please give us more details about what are dependencies
>> between Fuseki and Jena/ARQ/TDB?
>
>
> That would be the POM files :-)
>
> http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.2/jena-fuseki-0.2.2.pom
>
> http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.3/jena-fuseki-0.2.3.pom
>
>
> Fuseki 0.2.2 - ARQ 2.9.1 - Jena 2.7.1
> Fuseki 0.2.3 - ARQ 2.9.2 - Jena 2.7.2
>
>         Andy

Re: I need to get the root element of a ontology

Posted by Andy Seaborne <an...@apache.org>.
On 05/07/12 21:57, Milorad Tosic wrote:
> Would somebody please give us more details about what are dependencies between Fuseki and Jena/ARQ/TDB?

That would be the POM files :-)

http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.2/jena-fuseki-0.2.2.pom

http://repo1.maven.org/maven2/org/apache/jena/jena-fuseki/0.2.3/jena-fuseki-0.2.3.pom


Fuseki 0.2.2 - ARQ 2.9.1 - Jena 2.7.1
Fuseki 0.2.3 - ARQ 2.9.2 - Jena 2.7.2

	Andy

Re: I need to get the root element of a ontology

Posted by Rob Vesse <rv...@yarcdata.com>.
Fuseki depends on ARQ and TDB which themselves have dependencies on Jena
and the IRI library

Fuseki 0.2.3 -> ARQ 2.9.2
             -> TDB 0.9.2
                          -> Jena 2.7.2 -> IRI 0.9.2

Rob



On 7/5/12 1:57 PM, "Milorad Tosic" <mb...@yahoo.com> wrote:

>Would somebody please give us more details about what are dependencies
>between Fuseki and Jena/ARQ/TDB?
>
>Thanks,
>Milorad
>
>
>
>
>>________________________________
>> From: Federico López <fi...@gmail.com>
>>To: users@jena.apache.org; Milorad Tosic <mb...@yahoo.com>
>>Sent: Thursday, July 5, 2012 10:49 PM
>>Subject: Re: I need to get the root element of a ontology
>> 
>>Yes I was using the same ARQ with a different version of Fuseki. I think
>>that Fuseki have the improvement in the MINUS sentence...
>>
>>2012/7/5 Milorad Tosic <mb...@yahoo.com>
>>
>>> I do not understand now what has happened? First, you said that you
>>>were
>>> using ARQ 2.9.2 and measured 10x faster FILTER w.r.t. MINUS. Then, you
>>> tried instead the same query but with Fuseki 0.2.3 that should be
>>>using the
>>> same ARQ 2.9.2 version, but got the opposite result. Is that right?
>>>Looks
>>> like you run one of the experiments with different ARQ version (unless
>>> Fuseki does some magic :-))
>>>
>>>
>>>
>>> >________________________________
>>> > From: Federico López <fi...@gmail.com>
>>> >To: users@jena.apache.org
>>> >Sent: Thursday, July 5, 2012 8:51 PM
>>> >Subject: Re: I need to get the root element of a ontology
>>> >
>>> >I have run it with Fuseki Server 0.2.3 using the MINUS sentence an
>>>takes
>>> >0.499 s using the same Ontology that I have used before.
>>> >
>>> >And when a I try with the big one FMA (1'800.000 triples) it seems
>>>like
>>> >works faster than the FILTER sentece...
>>> >
>>> >2012/7/5 Federico López <fi...@gmail.com>
>>> >
>>> >> Well... I'm using the libraries that I get from de Maven
>>>Repository...
>>> >> Excuse me... I just have check and I have been using ARQ 2.9.2...
>>>But
>>> the
>>> >> Fuseki it is the old one... I going to try with the 0.2.3 version...
>>> >> Thanks A lot...
>>> >>
>>> >>
>>> >> 2012/7/5 Stephen Allen <sa...@apache.org>
>>> >>
>>> >>> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
>>> >>> which has the performance improvement for MINUS queries that Andy
>>>was
>>> >>> referring to.
>>> >>>
>>> >>> -Stephen
>>> >>>
>>> >>> [1] http://www.apache.org/dist/jena/binaries/
>>> >>>
>>> >>>
>>> >>> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com>
>>> wrote:
>>> >>> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I
>>>have
>>> 4GB
>>> >>> of
>>> >>> > RAM... (Excuse my poor English)
>>> >>> >
>>> >>> > 2012/7/5 Federico López <fi...@gmail.com>
>>> >>> >
>>> >>> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and
>>> Fuseki
>>> >>> >> 0.2.2) using with JUnit test.
>>> >>> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less)
>>>querying
>>> the
>>> >>> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS
>>>sentence
>>> >>> >> takes 56.762s (even more)...
>>> >>> >>
>>> >>> >>
>>> >>> >> 2012/7/5 Andy Seaborne <an...@apache.org>
>>> >>> >>
>>> >>> >>> On 05/07/12 18:30, Milorad Tosic wrote:
>>> >>> >>>
>>> >>> >>>> Would there by any differences in performance or eventually in
>>> result
>>> >>> >>>> set if we would substitute
>>> >>> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>> >>>> with
>>> >>> >>>>
>>> >>> >>>> MINUS { ?root rdfs:subClassOf ?super }
>>> >>> >>>> in the previous query?
>>> >>> >>>>
>>> >>> >>>> Milorad
>>> >>> >>>>
>>> >>> >>>
>>> >>> >>> Depends - also the required temporary memory needed is
>>>different.
>>> The
>>> >>> >>> MINUS implement is quite performant now (previously it would
>>>have
>>> been
>>> >>> >>> the case the FILTER version was faster).
>>> >>> >>>
>>> >>> >>> The FILTER version streams - constant memory overhead.
>>> >>> >>>
>>> >>> >>> The MINUS version uses temporary RAM - in proportion to the
>>>size of
>>> >>> the
>>> >>> >>> data matched.
>>> >>> >>>
>>> >>> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
>>> >>> inferences
>>> >>> >>> previous, it could be the MINUS version is slower.
>>> >>> >>>
>>> >>> >>> You'll have to try to be definitive.  If you try, do let us
>>>know.
>>> >>> >>>
>>> >>> >>>         Andy
>>> >>> >>>
>>> >>> >>>
>>> >>> >>>
>>> >>> >>>>
>>> >>> >>>>
>>> >>> >>>>  ______________________________**__
>>> >>> >>>>> From: Federico López <fi...@gmail.com>
>>> >>> >>>>> To: users@jena.apache.org
>>> >>> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
>>> >>> >>>>> Subject: Re: I need to get the root element of a ontology
>>> >>> >>>>>
>>> >>> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>> >>> >>>>>
>>> >>> >>>>>  On 05/07/12 06:49, Federico López wrote:
>>> >>> >>>>>>
>>> >>> >>>>>>  I looking for a good quey that allows me to get the roots
>>> >>> elements of
>>> >>> >>>>>>> a
>>> >>> >>>>>>> Ontology. Also, I need to know wich one of these roots have
>>> >>> >>>>>>> children...
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>>>  Version of Jena used?
>>> >>> >>>>>> I'm using fuseki 0.2.2...
>>> >>> >>>>>>
>>> >>> >>>>>>    I have each ontology in a NAMED GRAPH....
>>> >>> >>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>> And you are querying the union graph?
>>> >>> >>>>>>
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>> I'm Querying each GRAPH at time...
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>>>
>>> >>> >>>>>>
>>> >>> >>>>>>  This is what I using for it but the query is taking too
>>>much.
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>> How big is the data (in triples)?
>>> >>> >>>>>>
>>> >>> >>>>>>  Well...  I'm querying Biomedical Ontologies like
>>>FMA(1'859.969
>>> >>> >>>>> triples),
>>> >>> >>>>> RadLex(234.442), ICD10(165.310)...
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>>> Are you using inference?
>>> >>> >>>>>>
>>> >>> >>>>>
>>> >>> >>>>> I don't....
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>>>
>>> >>> >>>>>>
>>> >>> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>> >>> >>>>>>> FROM  <http://ontologyURI>
>>> >>> >>>>>>> WHERE
>>> >>> >>>>>>> {
>>> >>> >>>>>>>     ?root a ?class .
>>> >>> >>>>>>>     ?class rdfs:subClassOf owl:Class .
>>> >>> >>>>>>>     ?root rdfs:label ?label .
>>> >>> >>>>>>>     OPTIONAL {
>>> >>> >>>>>>>     ?root rdfs:subClassOf ?super .
>>> >>> >>>>>>>     }
>>> >>> >>>>>>>     OPTIONAL {
>>> >>> >>>>>>>     ?child rdfs:subClassOf ?root .
>>> >>> >>>>>>>     }
>>> >>> >>>>>>>     FILTER (!bound(?super))
>>> >>> >>>>>>> }
>>> >>> >>>>>>> GROUP BY ?root ?label
>>> >>> >>>>>>>
>>> >>> >>>>>>> Any idea?
>>> >>> >>>>>>>
>>> >>> >>>>>>> Thanks...
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>>>
>>> >>> >>>>>>>  without inference, this maybe what you want: I'm guessing
>>>from
>>> >>> your
>>> >>> >>>>>> description:
>>> >>> >>>>>>
>>> >>> >>>>>> SELECT ?root
>>> >>> >>>>>> {
>>> >>> >>>>>>     # A root is something that is of type class
>>> >>> >>>>>>     # which has no super class mentioned.
>>> >>> >>>>>>     ?root rdf:type owl:Class .
>>> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>> >>>>>>
>>> >>> >>>>>>     ?root rdfs:label ?label .
>>> >>> >>>>>> }
>>> >>> >>>>>>
>>> >>> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be
>>> cheap.
>>> >>> >>>>>>
>>> >>> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>> >>> >>>>>> {
>>> >>> >>>>>>     # A root is something that is of type class
>>> >>> >>>>>>     # which has no super class mentioned.
>>> >>> >>>>>>     ?root rdf:type owl:Class .
>>> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>> >>>>>>
>>> >>> >>>>>>     ?root rdfs:label ?label .
>>> >>> >>>>>>     # Children, any depth, by property paths
>>> >>> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>> >>> >>>>>> }
>>> >>> >>>>>> GROUP BY ?root
>>> >>> >>>>>>           Andy
>>> >>> >>>>>>
>>> >>> >>>>>>
>>> >>> >>>>> And thanks, I going to try your query, but I think that is
>>>just
>>> >>> that I
>>> >>> >>>>> need
>>> >>> >>>>> :D
>>> >>> >>>>>
>>> >>> >>>>> --
>>> >>> >>>>> *FEDERICO LÓPEZ GÓMEZ*
>>> >>> >>>>> Estudiante Ingeniería de Sistemas
>>> >>> >>>>> Universidad del Valle - Sede Tuluá
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>>>
>>> >>> >>>
>>> >>> >>>
>>> >>> >>
>>> >>> >>
>>> >>> >> --
>>> >>> >> *FEDERICO LÓPEZ GÓMEZ*
>>> >>> >> Estudiante Ingeniería de Sistemas
>>> >>> >> Universidad del Valle - Sede Tuluá
>>> >>> >>
>>> >>> >>
>>> >>> >
>>> >>> >
>>> >>> > --
>>> >>> > *FEDERICO LÓPEZ GÓMEZ*
>>> >>> > Estudiante Ingeniería de Sistemas
>>> >>> > Universidad del Valle - Sede Tuluá
>>> >>>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> *FEDERICO LÓPEZ GÓMEZ*
>>> >> Estudiante Ingeniería de Sistemas
>>> >> Universidad del Valle - Sede Tuluá
>>> >>
>>> >>
>>> >
>>> >
>>> >--
>>> >*FEDERICO LÓPEZ GÓMEZ*
>>> >Estudiante Ingeniería de Sistemas
>>> >Universidad del Valle - Sede Tuluá
>>> >
>>> >
>>> >
>>>
>>
>>
>>
>>-- 
>>*FEDERICO LÓPEZ GÓMEZ*
>>Estudiante Ingeniería de Sistemas
>>Universidad del Valle - Sede Tuluá
>>
>>


Re: I need to get the root element of a ontology

Posted by Milorad Tosic <mb...@yahoo.com>.
Would somebody please give us more details about what are dependencies between Fuseki and Jena/ARQ/TDB?

Thanks,
Milorad




>________________________________
> From: Federico López <fi...@gmail.com>
>To: users@jena.apache.org; Milorad Tosic <mb...@yahoo.com> 
>Sent: Thursday, July 5, 2012 10:49 PM
>Subject: Re: I need to get the root element of a ontology
> 
>Yes I was using the same ARQ with a different version of Fuseki. I think
>that Fuseki have the improvement in the MINUS sentence...
>
>2012/7/5 Milorad Tosic <mb...@yahoo.com>
>
>> I do not understand now what has happened? First, you said that you were
>> using ARQ 2.9.2 and measured 10x faster FILTER w.r.t. MINUS. Then, you
>> tried instead the same query but with Fuseki 0.2.3 that should be using the
>> same ARQ 2.9.2 version, but got the opposite result. Is that right? Looks
>> like you run one of the experiments with different ARQ version (unless
>> Fuseki does some magic :-))
>>
>>
>>
>> >________________________________
>> > From: Federico López <fi...@gmail.com>
>> >To: users@jena.apache.org
>> >Sent: Thursday, July 5, 2012 8:51 PM
>> >Subject: Re: I need to get the root element of a ontology
>> >
>> >I have run it with Fuseki Server 0.2.3 using the MINUS sentence an takes
>> >0.499 s using the same Ontology that I have used before.
>> >
>> >And when a I try with the big one FMA (1'800.000 triples) it seems like
>> >works faster than the FILTER sentece...
>> >
>> >2012/7/5 Federico López <fi...@gmail.com>
>> >
>> >> Well... I'm using the libraries that I get from de Maven Repository...
>> >> Excuse me... I just have check and I have been using ARQ 2.9.2... But
>> the
>> >> Fuseki it is the old one... I going to try with the 0.2.3 version...
>> >> Thanks A lot...
>> >>
>> >>
>> >> 2012/7/5 Stephen Allen <sa...@apache.org>
>> >>
>> >>> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
>> >>> which has the performance improvement for MINUS queries that Andy was
>> >>> referring to.
>> >>>
>> >>> -Stephen
>> >>>
>> >>> [1] http://www.apache.org/dist/jena/binaries/
>> >>>
>> >>>
>> >>> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com>
>> wrote:
>> >>> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have
>> 4GB
>> >>> of
>> >>> > RAM... (Excuse my poor English)
>> >>> >
>> >>> > 2012/7/5 Federico López <fi...@gmail.com>
>> >>> >
>> >>> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and
>> Fuseki
>> >>> >> 0.2.2) using with JUnit test.
>> >>> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying
>> the
>> >>> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
>> >>> >> takes 56.762s (even more)...
>> >>> >>
>> >>> >>
>> >>> >> 2012/7/5 Andy Seaborne <an...@apache.org>
>> >>> >>
>> >>> >>> On 05/07/12 18:30, Milorad Tosic wrote:
>> >>> >>>
>> >>> >>>> Would there by any differences in performance or eventually in
>> result
>> >>> >>>> set if we would substitute
>> >>> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>> >>>> with
>> >>> >>>>
>> >>> >>>> MINUS { ?root rdfs:subClassOf ?super }
>> >>> >>>> in the previous query?
>> >>> >>>>
>> >>> >>>> Milorad
>> >>> >>>>
>> >>> >>>
>> >>> >>> Depends - also the required temporary memory needed is different.
>> The
>> >>> >>> MINUS implement is quite performant now (previously it would have
>> been
>> >>> >>> the case the FILTER version was faster).
>> >>> >>>
>> >>> >>> The FILTER version streams - constant memory overhead.
>> >>> >>>
>> >>> >>> The MINUS version uses temporary RAM - in proportion to the size of
>> >>> the
>> >>> >>> data matched.
>> >>> >>>
>> >>> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
>> >>> inferences
>> >>> >>> previous, it could be the MINUS version is slower.
>> >>> >>>
>> >>> >>> You'll have to try to be definitive.  If you try, do let us know.
>> >>> >>>
>> >>> >>>         Andy
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>>>
>> >>> >>>>
>> >>> >>>>  ______________________________**__
>> >>> >>>>> From: Federico López <fi...@gmail.com>
>> >>> >>>>> To: users@jena.apache.org
>> >>> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
>> >>> >>>>> Subject: Re: I need to get the root element of a ontology
>> >>> >>>>>
>> >>> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>> >>> >>>>>
>> >>> >>>>>  On 05/07/12 06:49, Federico López wrote:
>> >>> >>>>>>
>> >>> >>>>>>  I looking for a good quey that allows me to get the roots
>> >>> elements of
>> >>> >>>>>>> a
>> >>> >>>>>>> Ontology. Also, I need to know wich one of these roots have
>> >>> >>>>>>> children...
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>>>  Version of Jena used?
>> >>> >>>>>> I'm using fuseki 0.2.2...
>> >>> >>>>>>
>> >>> >>>>>>    I have each ontology in a NAMED GRAPH....
>> >>> >>>>>>
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>> And you are querying the union graph?
>> >>> >>>>>>
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>> I'm Querying each GRAPH at time...
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>>>
>> >>> >>>>>>
>> >>> >>>>>>  This is what I using for it but the query is taking too much.
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>> How big is the data (in triples)?
>> >>> >>>>>>
>> >>> >>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>> >>> >>>>> triples),
>> >>> >>>>> RadLex(234.442), ICD10(165.310)...
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>>> Are you using inference?
>> >>> >>>>>>
>> >>> >>>>>
>> >>> >>>>> I don't....
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>>>
>> >>> >>>>>>
>> >>> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>> >>> >>>>>>> FROM  <http://ontologyURI>
>> >>> >>>>>>> WHERE
>> >>> >>>>>>> {
>> >>> >>>>>>>     ?root a ?class .
>> >>> >>>>>>>     ?class rdfs:subClassOf owl:Class .
>> >>> >>>>>>>     ?root rdfs:label ?label .
>> >>> >>>>>>>     OPTIONAL {
>> >>> >>>>>>>     ?root rdfs:subClassOf ?super .
>> >>> >>>>>>>     }
>> >>> >>>>>>>     OPTIONAL {
>> >>> >>>>>>>     ?child rdfs:subClassOf ?root .
>> >>> >>>>>>>     }
>> >>> >>>>>>>     FILTER (!bound(?super))
>> >>> >>>>>>> }
>> >>> >>>>>>> GROUP BY ?root ?label
>> >>> >>>>>>>
>> >>> >>>>>>> Any idea?
>> >>> >>>>>>>
>> >>> >>>>>>> Thanks...
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>>>
>> >>> >>>>>>>  without inference, this maybe what you want: I'm guessing from
>> >>> your
>> >>> >>>>>> description:
>> >>> >>>>>>
>> >>> >>>>>> SELECT ?root
>> >>> >>>>>> {
>> >>> >>>>>>     # A root is something that is of type class
>> >>> >>>>>>     # which has no super class mentioned.
>> >>> >>>>>>     ?root rdf:type owl:Class .
>> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>> >>>>>>
>> >>> >>>>>>     ?root rdfs:label ?label .
>> >>> >>>>>> }
>> >>> >>>>>>
>> >>> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be
>> cheap.
>> >>> >>>>>>
>> >>> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>> >>> >>>>>> {
>> >>> >>>>>>     # A root is something that is of type class
>> >>> >>>>>>     # which has no super class mentioned.
>> >>> >>>>>>     ?root rdf:type owl:Class .
>> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>> >>>>>>
>> >>> >>>>>>     ?root rdfs:label ?label .
>> >>> >>>>>>     # Children, any depth, by property paths
>> >>> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>> >>> >>>>>> }
>> >>> >>>>>> GROUP BY ?root
>> >>> >>>>>>           Andy
>> >>> >>>>>>
>> >>> >>>>>>
>> >>> >>>>> And thanks, I going to try your query, but I think that is just
>> >>> that I
>> >>> >>>>> need
>> >>> >>>>> :D
>> >>> >>>>>
>> >>> >>>>> --
>> >>> >>>>> *FEDERICO LÓPEZ GÓMEZ*
>> >>> >>>>> Estudiante Ingeniería de Sistemas
>> >>> >>>>> Universidad del Valle - Sede Tuluá
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>
>> >>> >>>
>> >>> >>
>> >>> >>
>> >>> >> --
>> >>> >> *FEDERICO LÓPEZ GÓMEZ*
>> >>> >> Estudiante Ingeniería de Sistemas
>> >>> >> Universidad del Valle - Sede Tuluá
>> >>> >>
>> >>> >>
>> >>> >
>> >>> >
>> >>> > --
>> >>> > *FEDERICO LÓPEZ GÓMEZ*
>> >>> > Estudiante Ingeniería de Sistemas
>> >>> > Universidad del Valle - Sede Tuluá
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> *FEDERICO LÓPEZ GÓMEZ*
>> >> Estudiante Ingeniería de Sistemas
>> >> Universidad del Valle - Sede Tuluá
>> >>
>> >>
>> >
>> >
>> >--
>> >*FEDERICO LÓPEZ GÓMEZ*
>> >Estudiante Ingeniería de Sistemas
>> >Universidad del Valle - Sede Tuluá
>> >
>> >
>> >
>>
>
>
>
>-- 
>*FEDERICO LÓPEZ GÓMEZ*
>Estudiante Ingeniería de Sistemas
>Universidad del Valle - Sede Tuluá
>
>
>

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
Yes I was using the same ARQ with a different version of Fuseki. I think
that Fuseki have the improvement in the MINUS sentence...

2012/7/5 Milorad Tosic <mb...@yahoo.com>

> I do not understand now what has happened? First, you said that you were
> using ARQ 2.9.2 and measured 10x faster FILTER w.r.t. MINUS. Then, you
> tried instead the same query but with Fuseki 0.2.3 that should be using the
> same ARQ 2.9.2 version, but got the opposite result. Is that right? Looks
> like you run one of the experiments with different ARQ version (unless
> Fuseki does some magic :-))
>
>
>
> >________________________________
> > From: Federico López <fi...@gmail.com>
> >To: users@jena.apache.org
> >Sent: Thursday, July 5, 2012 8:51 PM
> >Subject: Re: I need to get the root element of a ontology
> >
> >I have run it with Fuseki Server 0.2.3 using the MINUS sentence an takes
> >0.499 s using the same Ontology that I have used before.
> >
> >And when a I try with the big one FMA (1'800.000 triples) it seems like
> >works faster than the FILTER sentece...
> >
> >2012/7/5 Federico López <fi...@gmail.com>
> >
> >> Well... I'm using the libraries that I get from de Maven Repository...
> >> Excuse me... I just have check and I have been using ARQ 2.9.2... But
> the
> >> Fuseki it is the old one... I going to try with the 0.2.3 version...
> >> Thanks A lot...
> >>
> >>
> >> 2012/7/5 Stephen Allen <sa...@apache.org>
> >>
> >>> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
> >>> which has the performance improvement for MINUS queries that Andy was
> >>> referring to.
> >>>
> >>> -Stephen
> >>>
> >>> [1] http://www.apache.org/dist/jena/binaries/
> >>>
> >>>
> >>> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com>
> wrote:
> >>> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have
> 4GB
> >>> of
> >>> > RAM... (Excuse my poor English)
> >>> >
> >>> > 2012/7/5 Federico López <fi...@gmail.com>
> >>> >
> >>> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and
> Fuseki
> >>> >> 0.2.2) using with JUnit test.
> >>> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying
> the
> >>> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
> >>> >> takes 56.762s (even more)...
> >>> >>
> >>> >>
> >>> >> 2012/7/5 Andy Seaborne <an...@apache.org>
> >>> >>
> >>> >>> On 05/07/12 18:30, Milorad Tosic wrote:
> >>> >>>
> >>> >>>> Would there by any differences in performance or eventually in
> result
> >>> >>>> set if we would substitute
> >>> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>> >>>> with
> >>> >>>>
> >>> >>>> MINUS { ?root rdfs:subClassOf ?super }
> >>> >>>> in the previous query?
> >>> >>>>
> >>> >>>> Milorad
> >>> >>>>
> >>> >>>
> >>> >>> Depends - also the required temporary memory needed is different.
> The
> >>> >>> MINUS implement is quite performant now (previously it would have
> been
> >>> >>> the case the FILTER version was faster).
> >>> >>>
> >>> >>> The FILTER version streams - constant memory overhead.
> >>> >>>
> >>> >>> The MINUS version uses temporary RAM - in proportion to the size of
> >>> the
> >>> >>> data matched.
> >>> >>>
> >>> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
> >>> inferences
> >>> >>> previous, it could be the MINUS version is slower.
> >>> >>>
> >>> >>> You'll have to try to be definitive.  If you try, do let us know.
> >>> >>>
> >>> >>>         Andy
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>>
> >>> >>>>
> >>> >>>>  ______________________________**__
> >>> >>>>> From: Federico López <fi...@gmail.com>
> >>> >>>>> To: users@jena.apache.org
> >>> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
> >>> >>>>> Subject: Re: I need to get the root element of a ontology
> >>> >>>>>
> >>> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
> >>> >>>>>
> >>> >>>>>  On 05/07/12 06:49, Federico López wrote:
> >>> >>>>>>
> >>> >>>>>>  I looking for a good quey that allows me to get the roots
> >>> elements of
> >>> >>>>>>> a
> >>> >>>>>>> Ontology. Also, I need to know wich one of these roots have
> >>> >>>>>>> children...
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>>>  Version of Jena used?
> >>> >>>>>> I'm using fuseki 0.2.2...
> >>> >>>>>>
> >>> >>>>>>    I have each ontology in a NAMED GRAPH....
> >>> >>>>>>
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>> And you are querying the union graph?
> >>> >>>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>> I'm Querying each GRAPH at time...
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>>
> >>> >>>>>>
> >>> >>>>>>  This is what I using for it but the query is taking too much.
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>> How big is the data (in triples)?
> >>> >>>>>>
> >>> >>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
> >>> >>>>> triples),
> >>> >>>>> RadLex(234.442), ICD10(165.310)...
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>> Are you using inference?
> >>> >>>>>>
> >>> >>>>>
> >>> >>>>> I don't....
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>>
> >>> >>>>>>
> >>> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
> >>> >>>>>>> FROM  <http://ontologyURI>
> >>> >>>>>>> WHERE
> >>> >>>>>>> {
> >>> >>>>>>>     ?root a ?class .
> >>> >>>>>>>     ?class rdfs:subClassOf owl:Class .
> >>> >>>>>>>     ?root rdfs:label ?label .
> >>> >>>>>>>     OPTIONAL {
> >>> >>>>>>>     ?root rdfs:subClassOf ?super .
> >>> >>>>>>>     }
> >>> >>>>>>>     OPTIONAL {
> >>> >>>>>>>     ?child rdfs:subClassOf ?root .
> >>> >>>>>>>     }
> >>> >>>>>>>     FILTER (!bound(?super))
> >>> >>>>>>> }
> >>> >>>>>>> GROUP BY ?root ?label
> >>> >>>>>>>
> >>> >>>>>>> Any idea?
> >>> >>>>>>>
> >>> >>>>>>> Thanks...
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>>>
> >>> >>>>>>>  without inference, this maybe what you want: I'm guessing from
> >>> your
> >>> >>>>>> description:
> >>> >>>>>>
> >>> >>>>>> SELECT ?root
> >>> >>>>>> {
> >>> >>>>>>     # A root is something that is of type class
> >>> >>>>>>     # which has no super class mentioned.
> >>> >>>>>>     ?root rdf:type owl:Class .
> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>> >>>>>>
> >>> >>>>>>     ?root rdfs:label ?label .
> >>> >>>>>> }
> >>> >>>>>>
> >>> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be
> cheap.
> >>> >>>>>>
> >>> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
> >>> >>>>>> {
> >>> >>>>>>     # A root is something that is of type class
> >>> >>>>>>     # which has no super class mentioned.
> >>> >>>>>>     ?root rdf:type owl:Class .
> >>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>> >>>>>>
> >>> >>>>>>     ?root rdfs:label ?label .
> >>> >>>>>>     # Children, any depth, by property paths
> >>> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
> >>> >>>>>> }
> >>> >>>>>> GROUP BY ?root
> >>> >>>>>>           Andy
> >>> >>>>>>
> >>> >>>>>>
> >>> >>>>> And thanks, I going to try your query, but I think that is just
> >>> that I
> >>> >>>>> need
> >>> >>>>> :D
> >>> >>>>>
> >>> >>>>> --
> >>> >>>>> *FEDERICO LÓPEZ GÓMEZ*
> >>> >>>>> Estudiante Ingeniería de Sistemas
> >>> >>>>> Universidad del Valle - Sede Tuluá
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>
> >>> >>>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> *FEDERICO LÓPEZ GÓMEZ*
> >>> >> Estudiante Ingeniería de Sistemas
> >>> >> Universidad del Valle - Sede Tuluá
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> > *FEDERICO LÓPEZ GÓMEZ*
> >>> > Estudiante Ingeniería de Sistemas
> >>> > Universidad del Valle - Sede Tuluá
> >>>
> >>
> >>
> >>
> >> --
> >> *FEDERICO LÓPEZ GÓMEZ*
> >> Estudiante Ingeniería de Sistemas
> >> Universidad del Valle - Sede Tuluá
> >>
> >>
> >
> >
> >--
> >*FEDERICO LÓPEZ GÓMEZ*
> >Estudiante Ingeniería de Sistemas
> >Universidad del Valle - Sede Tuluá
> >
> >
> >
>



-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Milorad Tosic <mb...@yahoo.com>.
I do not understand now what has happened? First, you said that you were using ARQ 2.9.2 and measured 10x faster FILTER w.r.t. MINUS. Then, you tried instead the same query but with Fuseki 0.2.3 that should be using the same ARQ 2.9.2 version, but got the opposite result. Is that right? Looks like you run one of the experiments with different ARQ version (unless Fuseki does some magic :-))



>________________________________
> From: Federico López <fi...@gmail.com>
>To: users@jena.apache.org 
>Sent: Thursday, July 5, 2012 8:51 PM
>Subject: Re: I need to get the root element of a ontology
> 
>I have run it with Fuseki Server 0.2.3 using the MINUS sentence an takes
>0.499 s using the same Ontology that I have used before.
>
>And when a I try with the big one FMA (1'800.000 triples) it seems like
>works faster than the FILTER sentece...
>
>2012/7/5 Federico López <fi...@gmail.com>
>
>> Well... I'm using the libraries that I get from de Maven Repository...
>> Excuse me... I just have check and I have been using ARQ 2.9.2... But the
>> Fuseki it is the old one... I going to try with the 0.2.3 version...
>> Thanks A lot...
>>
>>
>> 2012/7/5 Stephen Allen <sa...@apache.org>
>>
>>> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
>>> which has the performance improvement for MINUS queries that Andy was
>>> referring to.
>>>
>>> -Stephen
>>>
>>> [1] http://www.apache.org/dist/jena/binaries/
>>>
>>>
>>> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com> wrote:
>>> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB
>>> of
>>> > RAM... (Excuse my poor English)
>>> >
>>> > 2012/7/5 Federico López <fi...@gmail.com>
>>> >
>>> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
>>> >> 0.2.2) using with JUnit test.
>>> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
>>> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
>>> >> takes 56.762s (even more)...
>>> >>
>>> >>
>>> >> 2012/7/5 Andy Seaborne <an...@apache.org>
>>> >>
>>> >>> On 05/07/12 18:30, Milorad Tosic wrote:
>>> >>>
>>> >>>> Would there by any differences in performance or eventually in result
>>> >>>> set if we would substitute
>>> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>>> with
>>> >>>>
>>> >>>> MINUS { ?root rdfs:subClassOf ?super }
>>> >>>> in the previous query?
>>> >>>>
>>> >>>> Milorad
>>> >>>>
>>> >>>
>>> >>> Depends - also the required temporary memory needed is different.  The
>>> >>> MINUS implement is quite performant now (previously it would have been
>>> >>> the case the FILTER version was faster).
>>> >>>
>>> >>> The FILTER version streams - constant memory overhead.
>>> >>>
>>> >>> The MINUS version uses temporary RAM - in proportion to the size of
>>> the
>>> >>> data matched.
>>> >>>
>>> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
>>> inferences
>>> >>> previous, it could be the MINUS version is slower.
>>> >>>
>>> >>> You'll have to try to be definitive.  If you try, do let us know.
>>> >>>
>>> >>>         Andy
>>> >>>
>>> >>>
>>> >>>
>>> >>>>
>>> >>>>
>>> >>>>  ______________________________**__
>>> >>>>> From: Federico López <fi...@gmail.com>
>>> >>>>> To: users@jena.apache.org
>>> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
>>> >>>>> Subject: Re: I need to get the root element of a ontology
>>> >>>>>
>>> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>> >>>>>
>>> >>>>>  On 05/07/12 06:49, Federico López wrote:
>>> >>>>>>
>>> >>>>>>  I looking for a good quey that allows me to get the roots
>>> elements of
>>> >>>>>>> a
>>> >>>>>>> Ontology. Also, I need to know wich one of these roots have
>>> >>>>>>> children...
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>>  Version of Jena used?
>>> >>>>>> I'm using fuseki 0.2.2...
>>> >>>>>>
>>> >>>>>>    I have each ontology in a NAMED GRAPH....
>>> >>>>>>
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>> And you are querying the union graph?
>>> >>>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> I'm Querying each GRAPH at time...
>>> >>>>>
>>> >>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>  This is what I using for it but the query is taking too much.
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>> How big is the data (in triples)?
>>> >>>>>>
>>> >>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>>> >>>>> triples),
>>> >>>>> RadLex(234.442), ICD10(165.310)...
>>> >>>>>
>>> >>>>>
>>> >>>>>> Are you using inference?
>>> >>>>>>
>>> >>>>>
>>> >>>>> I don't....
>>> >>>>>
>>> >>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>> >>>>>>> FROM  <http://ontologyURI>
>>> >>>>>>> WHERE
>>> >>>>>>> {
>>> >>>>>>>     ?root a ?class .
>>> >>>>>>>     ?class rdfs:subClassOf owl:Class .
>>> >>>>>>>     ?root rdfs:label ?label .
>>> >>>>>>>     OPTIONAL {
>>> >>>>>>>     ?root rdfs:subClassOf ?super .
>>> >>>>>>>     }
>>> >>>>>>>     OPTIONAL {
>>> >>>>>>>     ?child rdfs:subClassOf ?root .
>>> >>>>>>>     }
>>> >>>>>>>     FILTER (!bound(?super))
>>> >>>>>>> }
>>> >>>>>>> GROUP BY ?root ?label
>>> >>>>>>>
>>> >>>>>>> Any idea?
>>> >>>>>>>
>>> >>>>>>> Thanks...
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>>  without inference, this maybe what you want: I'm guessing from
>>> your
>>> >>>>>> description:
>>> >>>>>>
>>> >>>>>> SELECT ?root
>>> >>>>>> {
>>> >>>>>>     # A root is something that is of type class
>>> >>>>>>     # which has no super class mentioned.
>>> >>>>>>     ?root rdf:type owl:Class .
>>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>>>>>
>>> >>>>>>     ?root rdfs:label ?label .
>>> >>>>>> }
>>> >>>>>>
>>> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>> >>>>>>
>>> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>> >>>>>> {
>>> >>>>>>     # A root is something that is of type class
>>> >>>>>>     # which has no super class mentioned.
>>> >>>>>>     ?root rdf:type owl:Class .
>>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> >>>>>>
>>> >>>>>>     ?root rdfs:label ?label .
>>> >>>>>>     # Children, any depth, by property paths
>>> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>> >>>>>> }
>>> >>>>>> GROUP BY ?root
>>> >>>>>>           Andy
>>> >>>>>>
>>> >>>>>>
>>> >>>>> And thanks, I going to try your query, but I think that is just
>>> that I
>>> >>>>> need
>>> >>>>> :D
>>> >>>>>
>>> >>>>> --
>>> >>>>> *FEDERICO LÓPEZ GÓMEZ*
>>> >>>>> Estudiante Ingeniería de Sistemas
>>> >>>>> Universidad del Valle - Sede Tuluá
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>
>>> >>>
>>> >>
>>> >>
>>> >> --
>>> >> *FEDERICO LÓPEZ GÓMEZ*
>>> >> Estudiante Ingeniería de Sistemas
>>> >> Universidad del Valle - Sede Tuluá
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > *FEDERICO LÓPEZ GÓMEZ*
>>> > Estudiante Ingeniería de Sistemas
>>> > Universidad del Valle - Sede Tuluá
>>>
>>
>>
>>
>> --
>> *FEDERICO LÓPEZ GÓMEZ*
>> Estudiante Ingeniería de Sistemas
>> Universidad del Valle - Sede Tuluá
>>
>>
>
>
>-- 
>*FEDERICO LÓPEZ GÓMEZ*
>Estudiante Ingeniería de Sistemas
>Universidad del Valle - Sede Tuluá
>
>
>

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
I have run it with Fuseki Server 0.2.3 using the MINUS sentence an takes
0.499 s using the same Ontology that I have used before.

And when a I try with the big one FMA (1'800.000 triples) it seems like
works faster than the FILTER sentece...

2012/7/5 Federico López <fi...@gmail.com>

> Well... I'm using the libraries that I get from de Maven Repository...
> Excuse me... I just have check and I have been using ARQ 2.9.2... But the
> Fuseki it is the old one... I going to try with the 0.2.3 version...
> Thanks A lot...
>
>
> 2012/7/5 Stephen Allen <sa...@apache.org>
>
>> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
>> which has the performance improvement for MINUS queries that Andy was
>> referring to.
>>
>> -Stephen
>>
>> [1] http://www.apache.org/dist/jena/binaries/
>>
>>
>> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com> wrote:
>> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB
>> of
>> > RAM... (Excuse my poor English)
>> >
>> > 2012/7/5 Federico López <fi...@gmail.com>
>> >
>> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
>> >> 0.2.2) using with JUnit test.
>> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
>> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
>> >> takes 56.762s (even more)...
>> >>
>> >>
>> >> 2012/7/5 Andy Seaborne <an...@apache.org>
>> >>
>> >>> On 05/07/12 18:30, Milorad Tosic wrote:
>> >>>
>> >>>> Would there by any differences in performance or eventually in result
>> >>>> set if we would substitute
>> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>>> with
>> >>>>
>> >>>> MINUS { ?root rdfs:subClassOf ?super }
>> >>>> in the previous query?
>> >>>>
>> >>>> Milorad
>> >>>>
>> >>>
>> >>> Depends - also the required temporary memory needed is different.  The
>> >>> MINUS implement is quite performant now (previously it would have been
>> >>> the case the FILTER version was faster).
>> >>>
>> >>> The FILTER version streams - constant memory overhead.
>> >>>
>> >>> The MINUS version uses temporary RAM - in proportion to the size of
>> the
>> >>> data matched.
>> >>>
>> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
>> inferences
>> >>> previous, it could be the MINUS version is slower.
>> >>>
>> >>> You'll have to try to be definitive.  If you try, do let us know.
>> >>>
>> >>>         Andy
>> >>>
>> >>>
>> >>>
>> >>>>
>> >>>>
>> >>>>  ______________________________**__
>> >>>>> From: Federico López <fi...@gmail.com>
>> >>>>> To: users@jena.apache.org
>> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
>> >>>>> Subject: Re: I need to get the root element of a ontology
>> >>>>>
>> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>> >>>>>
>> >>>>>  On 05/07/12 06:49, Federico López wrote:
>> >>>>>>
>> >>>>>>  I looking for a good quey that allows me to get the roots
>> elements of
>> >>>>>>> a
>> >>>>>>> Ontology. Also, I need to know wich one of these roots have
>> >>>>>>> children...
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>  Version of Jena used?
>> >>>>>> I'm using fuseki 0.2.2...
>> >>>>>>
>> >>>>>>    I have each ontology in a NAMED GRAPH....
>> >>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>> And you are querying the union graph?
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>> I'm Querying each GRAPH at time...
>> >>>>>
>> >>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>  This is what I using for it but the query is taking too much.
>> >>>>>>>
>> >>>>>>>
>> >>>>>> How big is the data (in triples)?
>> >>>>>>
>> >>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>> >>>>> triples),
>> >>>>> RadLex(234.442), ICD10(165.310)...
>> >>>>>
>> >>>>>
>> >>>>>> Are you using inference?
>> >>>>>>
>> >>>>>
>> >>>>> I don't....
>> >>>>>
>> >>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>> >>>>>>> FROM  <http://ontologyURI>
>> >>>>>>> WHERE
>> >>>>>>> {
>> >>>>>>>     ?root a ?class .
>> >>>>>>>     ?class rdfs:subClassOf owl:Class .
>> >>>>>>>     ?root rdfs:label ?label .
>> >>>>>>>     OPTIONAL {
>> >>>>>>>     ?root rdfs:subClassOf ?super .
>> >>>>>>>     }
>> >>>>>>>     OPTIONAL {
>> >>>>>>>     ?child rdfs:subClassOf ?root .
>> >>>>>>>     }
>> >>>>>>>     FILTER (!bound(?super))
>> >>>>>>> }
>> >>>>>>> GROUP BY ?root ?label
>> >>>>>>>
>> >>>>>>> Any idea?
>> >>>>>>>
>> >>>>>>> Thanks...
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>  without inference, this maybe what you want: I'm guessing from
>> your
>> >>>>>> description:
>> >>>>>>
>> >>>>>> SELECT ?root
>> >>>>>> {
>> >>>>>>     # A root is something that is of type class
>> >>>>>>     # which has no super class mentioned.
>> >>>>>>     ?root rdf:type owl:Class .
>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>>>>>
>> >>>>>>     ?root rdfs:label ?label .
>> >>>>>> }
>> >>>>>>
>> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>> >>>>>>
>> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>> >>>>>> {
>> >>>>>>     # A root is something that is of type class
>> >>>>>>     # which has no super class mentioned.
>> >>>>>>     ?root rdf:type owl:Class .
>> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> >>>>>>
>> >>>>>>     ?root rdfs:label ?label .
>> >>>>>>     # Children, any depth, by property paths
>> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>> >>>>>> }
>> >>>>>> GROUP BY ?root
>> >>>>>>           Andy
>> >>>>>>
>> >>>>>>
>> >>>>> And thanks, I going to try your query, but I think that is just
>> that I
>> >>>>> need
>> >>>>> :D
>> >>>>>
>> >>>>> --
>> >>>>> *FEDERICO LÓPEZ GÓMEZ*
>> >>>>> Estudiante Ingeniería de Sistemas
>> >>>>> Universidad del Valle - Sede Tuluá
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>
>> >>>
>> >>
>> >>
>> >> --
>> >> *FEDERICO LÓPEZ GÓMEZ*
>> >> Estudiante Ingeniería de Sistemas
>> >> Universidad del Valle - Sede Tuluá
>> >>
>> >>
>> >
>> >
>> > --
>> > *FEDERICO LÓPEZ GÓMEZ*
>> > Estudiante Ingeniería de Sistemas
>> > Universidad del Valle - Sede Tuluá
>>
>
>
>
> --
> *FEDERICO LÓPEZ GÓMEZ*
> Estudiante Ingeniería de Sistemas
> Universidad del Valle - Sede Tuluá
>
>


-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
Well... I'm using the libraries that I get from de Maven Repository...
Excuse me... I just have check and I have been using ARQ 2.9.2... But the
Fuseki it is the old one... I going to try with the 0.2.3 version...
Thanks A lot...

2012/7/5 Stephen Allen <sa...@apache.org>

> Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
> which has the performance improvement for MINUS queries that Andy was
> referring to.
>
> -Stephen
>
> [1] http://www.apache.org/dist/jena/binaries/
>
>
> On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com> wrote:
> > Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB
> of
> > RAM... (Excuse my poor English)
> >
> > 2012/7/5 Federico López <fi...@gmail.com>
> >
> >> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
> >> 0.2.2) using with JUnit test.
> >> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
> >> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
> >> takes 56.762s (even more)...
> >>
> >>
> >> 2012/7/5 Andy Seaborne <an...@apache.org>
> >>
> >>> On 05/07/12 18:30, Milorad Tosic wrote:
> >>>
> >>>> Would there by any differences in performance or eventually in result
> >>>> set if we would substitute
> >>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>>> with
> >>>>
> >>>> MINUS { ?root rdfs:subClassOf ?super }
> >>>> in the previous query?
> >>>>
> >>>> Milorad
> >>>>
> >>>
> >>> Depends - also the required temporary memory needed is different.  The
> >>> MINUS implement is quite performant now (previously it would have been
> >>> the case the FILTER version was faster).
> >>>
> >>> The FILTER version streams - constant memory overhead.
> >>>
> >>> The MINUS version uses temporary RAM - in proportion to the size of the
> >>> data matched.
> >>>
> >>> If there are a lot of rdfs:subClassOf, e.g. have expanded the
> inferences
> >>> previous, it could be the MINUS version is slower.
> >>>
> >>> You'll have to try to be definitive.  If you try, do let us know.
> >>>
> >>>         Andy
> >>>
> >>>
> >>>
> >>>>
> >>>>
> >>>>  ______________________________**__
> >>>>> From: Federico López <fi...@gmail.com>
> >>>>> To: users@jena.apache.org
> >>>>> Sent: Thursday, July 5, 2012 5:28 PM
> >>>>> Subject: Re: I need to get the root element of a ontology
> >>>>>
> >>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
> >>>>>
> >>>>>  On 05/07/12 06:49, Federico López wrote:
> >>>>>>
> >>>>>>  I looking for a good quey that allows me to get the roots elements
> of
> >>>>>>> a
> >>>>>>> Ontology. Also, I need to know wich one of these roots have
> >>>>>>> children...
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>  Version of Jena used?
> >>>>>> I'm using fuseki 0.2.2...
> >>>>>>
> >>>>>>    I have each ontology in a NAMED GRAPH....
> >>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>> And you are querying the union graph?
> >>>>>>
> >>>>>
> >>>>>
> >>>>> I'm Querying each GRAPH at time...
> >>>>>
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>>  This is what I using for it but the query is taking too much.
> >>>>>>>
> >>>>>>>
> >>>>>> How big is the data (in triples)?
> >>>>>>
> >>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
> >>>>> triples),
> >>>>> RadLex(234.442), ICD10(165.310)...
> >>>>>
> >>>>>
> >>>>>> Are you using inference?
> >>>>>>
> >>>>>
> >>>>> I don't....
> >>>>>
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
> >>>>>>> FROM  <http://ontologyURI>
> >>>>>>> WHERE
> >>>>>>> {
> >>>>>>>     ?root a ?class .
> >>>>>>>     ?class rdfs:subClassOf owl:Class .
> >>>>>>>     ?root rdfs:label ?label .
> >>>>>>>     OPTIONAL {
> >>>>>>>     ?root rdfs:subClassOf ?super .
> >>>>>>>     }
> >>>>>>>     OPTIONAL {
> >>>>>>>     ?child rdfs:subClassOf ?root .
> >>>>>>>     }
> >>>>>>>     FILTER (!bound(?super))
> >>>>>>> }
> >>>>>>> GROUP BY ?root ?label
> >>>>>>>
> >>>>>>> Any idea?
> >>>>>>>
> >>>>>>> Thanks...
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>  without inference, this maybe what you want: I'm guessing from
> your
> >>>>>> description:
> >>>>>>
> >>>>>> SELECT ?root
> >>>>>> {
> >>>>>>     # A root is something that is of type class
> >>>>>>     # which has no super class mentioned.
> >>>>>>     ?root rdf:type owl:Class .
> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>>>>>
> >>>>>>     ?root rdfs:label ?label .
> >>>>>> }
> >>>>>>
> >>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
> >>>>>>
> >>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
> >>>>>> {
> >>>>>>     # A root is something that is of type class
> >>>>>>     # which has no super class mentioned.
> >>>>>>     ?root rdf:type owl:Class .
> >>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> >>>>>>
> >>>>>>     ?root rdfs:label ?label .
> >>>>>>     # Children, any depth, by property paths
> >>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
> >>>>>> }
> >>>>>> GROUP BY ?root
> >>>>>>           Andy
> >>>>>>
> >>>>>>
> >>>>> And thanks, I going to try your query, but I think that is just that
> I
> >>>>> need
> >>>>> :D
> >>>>>
> >>>>> --
> >>>>> *FEDERICO LÓPEZ GÓMEZ*
> >>>>> Estudiante Ingeniería de Sistemas
> >>>>> Universidad del Valle - Sede Tuluá
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>
> >>
> >> --
> >> *FEDERICO LÓPEZ GÓMEZ*
> >> Estudiante Ingeniería de Sistemas
> >> Universidad del Valle - Sede Tuluá
> >>
> >>
> >
> >
> > --
> > *FEDERICO LÓPEZ GÓMEZ*
> > Estudiante Ingeniería de Sistemas
> > Universidad del Valle - Sede Tuluá
>



-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Stephen Allen <sa...@apache.org>.
Do you mind trying it with Fuseki 0.2.3?  That contains ARQ 2.9.2
which has the performance improvement for MINUS queries that Andy was
referring to.

-Stephen

[1] http://www.apache.org/dist/jena/binaries/


On Thu, Jul 5, 2012 at 10:55 AM, Federico López <fi...@gmail.com> wrote:
> Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB of
> RAM... (Excuse my poor English)
>
> 2012/7/5 Federico López <fi...@gmail.com>
>
>> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
>> 0.2.2) using with JUnit test.
>> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
>> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
>> takes 56.762s (even more)...
>>
>>
>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>
>>> On 05/07/12 18:30, Milorad Tosic wrote:
>>>
>>>> Would there by any differences in performance or eventually in result
>>>> set if we would substitute
>>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>> with
>>>>
>>>> MINUS { ?root rdfs:subClassOf ?super }
>>>> in the previous query?
>>>>
>>>> Milorad
>>>>
>>>
>>> Depends - also the required temporary memory needed is different.  The
>>> MINUS implement is quite performant now (previously it would have been
>>> the case the FILTER version was faster).
>>>
>>> The FILTER version streams - constant memory overhead.
>>>
>>> The MINUS version uses temporary RAM - in proportion to the size of the
>>> data matched.
>>>
>>> If there are a lot of rdfs:subClassOf, e.g. have expanded the inferences
>>> previous, it could be the MINUS version is slower.
>>>
>>> You'll have to try to be definitive.  If you try, do let us know.
>>>
>>>         Andy
>>>
>>>
>>>
>>>>
>>>>
>>>>  ______________________________**__
>>>>> From: Federico López <fi...@gmail.com>
>>>>> To: users@jena.apache.org
>>>>> Sent: Thursday, July 5, 2012 5:28 PM
>>>>> Subject: Re: I need to get the root element of a ontology
>>>>>
>>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>>>>
>>>>>  On 05/07/12 06:49, Federico López wrote:
>>>>>>
>>>>>>  I looking for a good quey that allows me to get the roots elements of
>>>>>>> a
>>>>>>> Ontology. Also, I need to know wich one of these roots have
>>>>>>> children...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  Version of Jena used?
>>>>>> I'm using fuseki 0.2.2...
>>>>>>
>>>>>>    I have each ontology in a NAMED GRAPH....
>>>>>>
>>>>>>>
>>>>>>>
>>>>>> And you are querying the union graph?
>>>>>>
>>>>>
>>>>>
>>>>> I'm Querying each GRAPH at time...
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>  This is what I using for it but the query is taking too much.
>>>>>>>
>>>>>>>
>>>>>> How big is the data (in triples)?
>>>>>>
>>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>>>>> triples),
>>>>> RadLex(234.442), ICD10(165.310)...
>>>>>
>>>>>
>>>>>> Are you using inference?
>>>>>>
>>>>>
>>>>> I don't....
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>>>>>> FROM  <http://ontologyURI>
>>>>>>> WHERE
>>>>>>> {
>>>>>>>     ?root a ?class .
>>>>>>>     ?class rdfs:subClassOf owl:Class .
>>>>>>>     ?root rdfs:label ?label .
>>>>>>>     OPTIONAL {
>>>>>>>     ?root rdfs:subClassOf ?super .
>>>>>>>     }
>>>>>>>     OPTIONAL {
>>>>>>>     ?child rdfs:subClassOf ?root .
>>>>>>>     }
>>>>>>>     FILTER (!bound(?super))
>>>>>>> }
>>>>>>> GROUP BY ?root ?label
>>>>>>>
>>>>>>> Any idea?
>>>>>>>
>>>>>>> Thanks...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>  without inference, this maybe what you want: I'm guessing from your
>>>>>> description:
>>>>>>
>>>>>> SELECT ?root
>>>>>> {
>>>>>>     # A root is something that is of type class
>>>>>>     # which has no super class mentioned.
>>>>>>     ?root rdf:type owl:Class .
>>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>>
>>>>>>     ?root rdfs:label ?label .
>>>>>> }
>>>>>>
>>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>>>>>
>>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>>>>> {
>>>>>>     # A root is something that is of type class
>>>>>>     # which has no super class mentioned.
>>>>>>     ?root rdf:type owl:Class .
>>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>>
>>>>>>     ?root rdfs:label ?label .
>>>>>>     # Children, any depth, by property paths
>>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>>>>> }
>>>>>> GROUP BY ?root
>>>>>>           Andy
>>>>>>
>>>>>>
>>>>> And thanks, I going to try your query, but I think that is just that I
>>>>> need
>>>>> :D
>>>>>
>>>>> --
>>>>> *FEDERICO LÓPEZ GÓMEZ*
>>>>> Estudiante Ingeniería de Sistemas
>>>>> Universidad del Valle - Sede Tuluá
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>> --
>> *FEDERICO LÓPEZ GÓMEZ*
>> Estudiante Ingeniería de Sistemas
>> Universidad del Valle - Sede Tuluá
>>
>>
>
>
> --
> *FEDERICO LÓPEZ GÓMEZ*
> Estudiante Ingeniería de Sistemas
> Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
Mi PC is an Intel  Core 2 Quad Q2800 @2.33Ghz 2.33Ghz... And I have 4GB of
RAM... (Excuse my poor English)

2012/7/5 Federico López <fi...@gmail.com>

> I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
> 0.2.2) using with JUnit test.
> With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
> roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence
> takes 56.762s (even more)...
>
>
> 2012/7/5 Andy Seaborne <an...@apache.org>
>
>> On 05/07/12 18:30, Milorad Tosic wrote:
>>
>>> Would there by any differences in performance or eventually in result
>>> set if we would substitute
>>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>> with
>>>
>>> MINUS { ?root rdfs:subClassOf ?super }
>>> in the previous query?
>>>
>>> Milorad
>>>
>>
>> Depends - also the required temporary memory needed is different.  The
>> MINUS implement is quite performant now (previously it would have been
>> the case the FILTER version was faster).
>>
>> The FILTER version streams - constant memory overhead.
>>
>> The MINUS version uses temporary RAM - in proportion to the size of the
>> data matched.
>>
>> If there are a lot of rdfs:subClassOf, e.g. have expanded the inferences
>> previous, it could be the MINUS version is slower.
>>
>> You'll have to try to be definitive.  If you try, do let us know.
>>
>>         Andy
>>
>>
>>
>>>
>>>
>>>  ______________________________**__
>>>> From: Federico López <fi...@gmail.com>
>>>> To: users@jena.apache.org
>>>> Sent: Thursday, July 5, 2012 5:28 PM
>>>> Subject: Re: I need to get the root element of a ontology
>>>>
>>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>>>
>>>>  On 05/07/12 06:49, Federico López wrote:
>>>>>
>>>>>  I looking for a good quey that allows me to get the roots elements of
>>>>>> a
>>>>>> Ontology. Also, I need to know wich one of these roots have
>>>>>> children...
>>>>>>
>>>>>>
>>>>>>
>>>>>>  Version of Jena used?
>>>>> I'm using fuseki 0.2.2...
>>>>>
>>>>>    I have each ontology in a NAMED GRAPH....
>>>>>
>>>>>>
>>>>>>
>>>>> And you are querying the union graph?
>>>>>
>>>>
>>>>
>>>> I'm Querying each GRAPH at time...
>>>>
>>>>
>>>>>
>>>>>
>>>>>  This is what I using for it but the query is taking too much.
>>>>>>
>>>>>>
>>>>> How big is the data (in triples)?
>>>>>
>>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>>>> triples),
>>>> RadLex(234.442), ICD10(165.310)...
>>>>
>>>>
>>>>> Are you using inference?
>>>>>
>>>>
>>>> I don't....
>>>>
>>>>
>>>>>
>>>>>
>>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>>>>> FROM  <http://ontologyURI>
>>>>>> WHERE
>>>>>> {
>>>>>>     ?root a ?class .
>>>>>>     ?class rdfs:subClassOf owl:Class .
>>>>>>     ?root rdfs:label ?label .
>>>>>>     OPTIONAL {
>>>>>>     ?root rdfs:subClassOf ?super .
>>>>>>     }
>>>>>>     OPTIONAL {
>>>>>>     ?child rdfs:subClassOf ?root .
>>>>>>     }
>>>>>>     FILTER (!bound(?super))
>>>>>> }
>>>>>> GROUP BY ?root ?label
>>>>>>
>>>>>> Any idea?
>>>>>>
>>>>>> Thanks...
>>>>>>
>>>>>>
>>>>>>
>>>>>>  without inference, this maybe what you want: I'm guessing from your
>>>>> description:
>>>>>
>>>>> SELECT ?root
>>>>> {
>>>>>     # A root is something that is of type class
>>>>>     # which has no super class mentioned.
>>>>>     ?root rdf:type owl:Class .
>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>
>>>>>     ?root rdfs:label ?label .
>>>>> }
>>>>>
>>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>>>>
>>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>>>> {
>>>>>     # A root is something that is of type class
>>>>>     # which has no super class mentioned.
>>>>>     ?root rdf:type owl:Class .
>>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>>
>>>>>     ?root rdfs:label ?label .
>>>>>     # Children, any depth, by property paths
>>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>>>> }
>>>>> GROUP BY ?root
>>>>>           Andy
>>>>>
>>>>>
>>>> And thanks, I going to try your query, but I think that is just that I
>>>> need
>>>> :D
>>>>
>>>> --
>>>> *FEDERICO LÓPEZ GÓMEZ*
>>>> Estudiante Ingeniería de Sistemas
>>>> Universidad del Valle - Sede Tuluá
>>>>
>>>>
>>>>
>>>>
>>
>>
>
>
> --
> *FEDERICO LÓPEZ GÓMEZ*
> Estudiante Ingeniería de Sistemas
> Universidad del Valle - Sede Tuluá
>
>


-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
I try the two queries in my Java project (I usea ARQ 2.8.8 and Fuseki
0.2.2) using with JUnit test.
With the FILTER NOT EXISTS sentece takes 0.724s (or less) querying the
roots in RadLex Ontology ( 234.442 triples), with the MINUS sentence takes
56.762s (even more)...

2012/7/5 Andy Seaborne <an...@apache.org>

> On 05/07/12 18:30, Milorad Tosic wrote:
>
>> Would there by any differences in performance or eventually in result set
>> if we would substitute
>> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>> with
>>
>> MINUS { ?root rdfs:subClassOf ?super }
>> in the previous query?
>>
>> Milorad
>>
>
> Depends - also the required temporary memory needed is different.  The
> MINUS implement is quite performant now (previously it would have been the
> case the FILTER version was faster).
>
> The FILTER version streams - constant memory overhead.
>
> The MINUS version uses temporary RAM - in proportion to the size of the
> data matched.
>
> If there are a lot of rdfs:subClassOf, e.g. have expanded the inferences
> previous, it could be the MINUS version is slower.
>
> You'll have to try to be definitive.  If you try, do let us know.
>
>         Andy
>
>
>
>>
>>
>>  ______________________________**__
>>> From: Federico López <fi...@gmail.com>
>>> To: users@jena.apache.org
>>> Sent: Thursday, July 5, 2012 5:28 PM
>>> Subject: Re: I need to get the root element of a ontology
>>>
>>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>>
>>>  On 05/07/12 06:49, Federico López wrote:
>>>>
>>>>  I looking for a good quey that allows me to get the roots elements of a
>>>>> Ontology. Also, I need to know wich one of these roots have children...
>>>>>
>>>>>
>>>>>
>>>>>  Version of Jena used?
>>>> I'm using fuseki 0.2.2...
>>>>
>>>>    I have each ontology in a NAMED GRAPH....
>>>>
>>>>>
>>>>>
>>>> And you are querying the union graph?
>>>>
>>>
>>>
>>> I'm Querying each GRAPH at time...
>>>
>>>
>>>>
>>>>
>>>>  This is what I using for it but the query is taking too much.
>>>>>
>>>>>
>>>> How big is the data (in triples)?
>>>>
>>>>  Well...  I'm querying Biomedical Ontologies like FMA(1'859.969
>>> triples),
>>> RadLex(234.442), ICD10(165.310)...
>>>
>>>
>>>> Are you using inference?
>>>>
>>>
>>> I don't....
>>>
>>>
>>>>
>>>>
>>>>  SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>>>> FROM  <http://ontologyURI>
>>>>> WHERE
>>>>> {
>>>>>     ?root a ?class .
>>>>>     ?class rdfs:subClassOf owl:Class .
>>>>>     ?root rdfs:label ?label .
>>>>>     OPTIONAL {
>>>>>     ?root rdfs:subClassOf ?super .
>>>>>     }
>>>>>     OPTIONAL {
>>>>>     ?child rdfs:subClassOf ?root .
>>>>>     }
>>>>>     FILTER (!bound(?super))
>>>>> }
>>>>> GROUP BY ?root ?label
>>>>>
>>>>> Any idea?
>>>>>
>>>>> Thanks...
>>>>>
>>>>>
>>>>>
>>>>>  without inference, this maybe what you want: I'm guessing from your
>>>> description:
>>>>
>>>> SELECT ?root
>>>> {
>>>>     # A root is something that is of type class
>>>>     # which has no super class mentioned.
>>>>     ?root rdf:type owl:Class .
>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>
>>>>     ?root rdfs:label ?label .
>>>> }
>>>>
>>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>>>
>>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>>> {
>>>>     # A root is something that is of type class
>>>>     # which has no super class mentioned.
>>>>     ?root rdf:type owl:Class .
>>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>>
>>>>     ?root rdfs:label ?label .
>>>>     # Children, any depth, by property paths
>>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>>> }
>>>> GROUP BY ?root
>>>>           Andy
>>>>
>>>>
>>> And thanks, I going to try your query, but I think that is just that I
>>> need
>>> :D
>>>
>>> --
>>> *FEDERICO LÓPEZ GÓMEZ*
>>> Estudiante Ingeniería de Sistemas
>>> Universidad del Valle - Sede Tuluá
>>>
>>>
>>>
>>>
>
>


-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Andy Seaborne <an...@apache.org>.
On 05/07/12 18:30, Milorad Tosic wrote:
> Would there by any differences in performance or eventually in result set if we would substitute
> FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
> with
>
> MINUS { ?root rdfs:subClassOf ?super }
> in the previous query?
>
> Milorad

Depends - also the required temporary memory needed is different.  The
MINUS implement is quite performant now (previously it would have been 
the case the FILTER version was faster).

The FILTER version streams - constant memory overhead.

The MINUS version uses temporary RAM - in proportion to the size of the 
data matched.

If there are a lot of rdfs:subClassOf, e.g. have expanded the inferences 
previous, it could be the MINUS version is slower.

You'll have to try to be definitive.  If you try, do let us know.

	Andy

>
>
>
>> ________________________________
>> From: Federico López <fi...@gmail.com>
>> To: users@jena.apache.org
>> Sent: Thursday, July 5, 2012 5:28 PM
>> Subject: Re: I need to get the root element of a ontology
>>
>> 2012/7/5 Andy Seaborne <an...@apache.org>
>>
>>> On 05/07/12 06:49, Federico López wrote:
>>>
>>>> I looking for a good quey that allows me to get the roots elements of a
>>>> Ontology. Also, I need to know wich one of these roots have children...
>>>>
>>>>
>>>>
>>> Version of Jena used?
>>> I'm using fuseki 0.2.2...
>>>
>>>    I have each ontology in a NAMED GRAPH....
>>>>
>>>
>>> And you are querying the union graph?
>>
>>
>> I'm Querying each GRAPH at time...
>>
>>>
>>>
>>>
>>>> This is what I using for it but the query is taking too much.
>>>>
>>>
>>> How big is the data (in triples)?
>>>
>> Well...  I'm querying Biomedical Ontologies like FMA(1'859.969 triples),
>> RadLex(234.442), ICD10(165.310)...
>>
>>>
>>> Are you using inference?
>>
>> I don't....
>>
>>>
>>>
>>>
>>>> SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>>> FROM  <http://ontologyURI>
>>>> WHERE
>>>> {
>>>>     ?root a ?class .
>>>>     ?class rdfs:subClassOf owl:Class .
>>>>     ?root rdfs:label ?label .
>>>>     OPTIONAL {
>>>>     ?root rdfs:subClassOf ?super .
>>>>     }
>>>>     OPTIONAL {
>>>>     ?child rdfs:subClassOf ?root .
>>>>     }
>>>>     FILTER (!bound(?super))
>>>> }
>>>> GROUP BY ?root ?label
>>>>
>>>> Any idea?
>>>>
>>>> Thanks...
>>>>
>>>>
>>>>
>>> without inference, this maybe what you want: I'm guessing from your
>>> description:
>>>
>>> SELECT ?root
>>> {
>>>     # A root is something that is of type class
>>>     # which has no super class mentioned.
>>>     ?root rdf:type owl:Class .
>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>
>>>     ?root rdfs:label ?label .
>>> }
>>>
>>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>>
>>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>>> {
>>>     # A root is something that is of type class
>>>     # which has no super class mentioned.
>>>     ?root rdf:type owl:Class .
>>>     FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>>
>>>     ?root rdfs:label ?label .
>>>     # Children, any depth, by property paths
>>>     OPTIONAL { ?child rdfs:subClassOf+ ?root }
>>> }
>>> GROUP BY ?root
>>>           Andy
>>>
>>
>> And thanks, I going to try your query, but I think that is just that I need
>> :D
>>
>> --
>> *FEDERICO LÓPEZ GÓMEZ*
>> Estudiante Ingeniería de Sistemas
>> Universidad del Valle - Sede Tuluá
>>
>>
>>



Re: I need to get the root element of a ontology

Posted by Milorad Tosic <mb...@yahoo.com>.
Would there by any differences in performance or eventually in result set if we would substitute 
FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
with

MINUS { ?root rdfs:subClassOf ?super }
in the previous query?

Milorad



>________________________________
> From: Federico López <fi...@gmail.com>
>To: users@jena.apache.org 
>Sent: Thursday, July 5, 2012 5:28 PM
>Subject: Re: I need to get the root element of a ontology
> 
>2012/7/5 Andy Seaborne <an...@apache.org>
>
>> On 05/07/12 06:49, Federico López wrote:
>>
>>> I looking for a good quey that allows me to get the roots elements of a
>>> Ontology. Also, I need to know wich one of these roots have children...
>>>
>>>
>>>
>> Version of Jena used?
>> I'm using fuseki 0.2.2...
>>
>>  I have each ontology in a NAMED GRAPH....
>>>
>>
>> And you are querying the union graph?
>
>
>I'm Querying each GRAPH at time...
>
>>
>>
>>
>>> This is what I using for it but the query is taking too much.
>>>
>>
>> How big is the data (in triples)?
>>
>Well...  I'm querying Biomedical Ontologies like FMA(1'859.969 triples),
>RadLex(234.442), ICD10(165.310)...
>
>>
>> Are you using inference?
>
>I don't....
>
>>
>>
>>
>>> SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>>> FROM  <http://ontologyURI>
>>> WHERE
>>> {
>>>   ?root a ?class .
>>>   ?class rdfs:subClassOf owl:Class .
>>>   ?root rdfs:label ?label .
>>>   OPTIONAL {
>>>   ?root rdfs:subClassOf ?super .
>>>   }
>>>   OPTIONAL {
>>>   ?child rdfs:subClassOf ?root .
>>>   }
>>>   FILTER (!bound(?super))
>>> }
>>> GROUP BY ?root ?label
>>>
>>> Any idea?
>>>
>>> Thanks...
>>>
>>>
>>>
>> without inference, this maybe what you want: I'm guessing from your
>> description:
>>
>> SELECT ?root
>> {
>>   # A root is something that is of type class
>>   # which has no super class mentioned.
>>   ?root rdf:type owl:Class .
>>   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>
>>   ?root rdfs:label ?label .
>> }
>>
>> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>>
>> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
>> {
>>   # A root is something that is of type class
>>   # which has no super class mentioned.
>>   ?root rdf:type owl:Class .
>>   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>>
>>   ?root rdfs:label ?label .
>>   # Children, any depth, by property paths
>>   OPTIONAL { ?child rdfs:subClassOf+ ?root }
>> }
>> GROUP BY ?root
>>         Andy
>>
>
>And thanks, I going to try your query, but I think that is just that I need
>:D
>
>-- 
>*FEDERICO LÓPEZ GÓMEZ*
>Estudiante Ingeniería de Sistemas
>Universidad del Valle - Sede Tuluá
>
>
>

Re: I need to get the root element of a ontology

Posted by Federico López <fi...@gmail.com>.
2012/7/5 Andy Seaborne <an...@apache.org>

> On 05/07/12 06:49, Federico López wrote:
>
>> I looking for a good quey that allows me to get the roots elements of a
>> Ontology. Also, I need to know wich one of these roots have children...
>>
>>
>>
> Version of Jena used?
> I'm using fuseki 0.2.2...
>
>  I have each ontology in a NAMED GRAPH....
>>
>
> And you are querying the union graph?


I'm Querying each GRAPH at time...

>
>
>
>> This is what I using for it but the query is taking too much.
>>
>
> How big is the data (in triples)?
>
Well...  I'm querying Biomedical Ontologies like FMA(1'859.969 triples),
RadLex(234.442), ICD10(165.310)...

>
> Are you using inference?

I don't....

>
>
>
>> SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
>> FROM  <http://ontologyURI>
>> WHERE
>> {
>>   ?root a ?class .
>>   ?class rdfs:subClassOf owl:Class .
>>   ?root rdfs:label ?label .
>>   OPTIONAL {
>>   ?root rdfs:subClassOf ?super .
>>   }
>>   OPTIONAL {
>>   ?child rdfs:subClassOf ?root .
>>   }
>>   FILTER (!bound(?super))
>> }
>> GROUP BY ?root ?label
>>
>> Any idea?
>>
>> Thanks...
>>
>>
>>
> without inference, this maybe what you want: I'm guessing from your
> description:
>
> SELECT ?root
> {
>   # A root is something that is of type class
>   # which has no super class mentioned.
>   ?root rdf:type owl:Class .
>   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>
>   ?root rdfs:label ?label .
> }
>
> Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.
>
> SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
> {
>   # A root is something that is of type class
>   # which has no super class mentioned.
>   ?root rdf:type owl:Class .
>   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
>
>   ?root rdfs:label ?label .
>   # Children, any depth, by property paths
>   OPTIONAL { ?child rdfs:subClassOf+ ?root }
> }
> GROUP BY ?root
>         Andy
>

And thanks, I going to try your query, but I think that is just that I need
:D

-- 
*FEDERICO LÓPEZ GÓMEZ*
Estudiante Ingeniería de Sistemas
Universidad del Valle - Sede Tuluá

Re: I need to get the root element of a ontology

Posted by Andy Seaborne <an...@apache.org>.
On 05/07/12 06:49, Federico López wrote:
> I looking for a good quey that allows me to get the roots elements of a
> Ontology. Also, I need to know wich one of these roots have children...
>
>

Version of Jena used?

> I have each ontology in a NAMED GRAPH....

And you are querying the union graph?

>
> This is what I using for it but the query is taking too much.

How big is the data (in triples)?

Are you using inference?

>
> SELECT DISTINCT ?root ?label (COUNT(?child) AS ?nChild)
> FROM  <http://ontologyURI>
> WHERE
> {
>   ?root a ?class .
>   ?class rdfs:subClassOf owl:Class .
>   ?root rdfs:label ?label .
>   OPTIONAL {
>   ?root rdfs:subClassOf ?super .
>   }
>   OPTIONAL {
>   ?child rdfs:subClassOf ?root .
>   }
>   FILTER (!bound(?super))
> }
> GROUP BY ?root ?label
>
> Any idea?
>
> Thanks...
>
>

without inference, this maybe what you want: I'm guessing from your 
description:

SELECT ?root
{
   # A root is something that is of type class
   # which has no super class mentioned.
   ?root rdf:type owl:Class .
   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
   ?root rdfs:label ?label .
}

Adding in the COUNT of ?child and GROUP BY is unlikely to be cheap.

SELECT ?root (COUNT(DISTINCT ?child) AS ?nChild)
{
   # A root is something that is of type class
   # which has no super class mentioned.
   ?root rdf:type owl:Class .
   FILTER NOT EXISTS { ?root rdfs:subClassOf ?super }
   ?root rdfs:label ?label .
   # Children, any depth, by property paths
   OPTIONAL { ?child rdfs:subClassOf+ ?root }
}
GROUP BY ?root
	Andy