You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by javed khan <ja...@gmail.com> on 2017/10/18 18:10:42 UTC

How to to access Dbpedia resource using variable

Good day

I want to ask is it possible we access Dbpedia resource  with a variable
name.
For example, we have ontology which include rdfs:comment about different
cities and cities name are in our ontology and store in x variable

?x rdfs:comment ?y  //This query works for me

Now we want to directly access Dbpedia server (not using ontologiy) for
these cities and this time we want to access rdfs:abstract, so can we use

?x rdfs:abstract ?sbstract

If not , how can we access then rdfs:abstract of different cities stored in
x

Thank you

Re: How to to access Dbpedia resource using variable

Posted by javed khan <ja...@gmail.com>.
Thank you Lorenz

I am done with the quiz project but I am just working on its second
version.

Regards

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Oct 19, 2017 at 2:29 PM, Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> wrote:

>
>
> On 19.10.2017 11:34, javed khan wrote:
> > Hello Lorenz, I knew I will not be able to explain my point.
> >
> > I have one class: Question  (What is capital city of Germany)
> > Another class : Answer (Berlin)
> > and similar question/answers instances.
> Are you still working on the quiz project? Have you seen that there is
> already related work?
> >
> > I want to show rdfs:comment of answers like Berlin,Madrid and it works
> >
> > So when I mentioned ?x  rdfs:comment  ?comment, the ?x contains Answers
> > like Berlin, Madrid
> >
> > After this query if I want to show the rdfs:abstract of Answers (Berlin
> > etc) from Dbpedia endpoint directly, is it possible?
> To repeat myself, the property rdfs:abstract does **not** exist! There
> is a DBpedia property called http://dbpedia.org/ontology/abstract
>
> And why should it not be possible? Send the query with the correct URIs
> of the cities to the DBpedia SPARQL endpoint to get the abstracts.
>
> One comment, your URIs do **not** match the URIs of DBpedia!
> * you have http://dbpedia.org/resource#London.
> * the correct DBpedia URI would be http://dbpedia.org/resource/London
> >
> > The instances data could be the following in my ontology:
> >
> > I have one suggestion: Is it possible we are allowed to paste a screen
> shot
> > of our ontology or something else in this group like we do in Protege
> > group?
> I think it's not possible by the mailing list system - but I'm not an
> admin. You could add links that refer image upload services  - as you
> should know.
> >
> > ___________________________
> >
> >
> >
> >
> >     <!-- http://xmlns.com/foaf/0.1/depiction#Q1 -->
> >
> >     <owl:NamedIndividual rdf:about="http://xmlns.com/
> foaf/0.1/depiction#Q1">
> >         <rdfs:label>What is the capital city of Germany?
> > </rdfs:label>
> >     </owl:NamedIndividual>
> >
> >
> >
> >     <!-- http://xmlns.com/foaf/0.1/depiction#Q2 -->
> >
> >     <owl:NamedIndividual rdf:about="http://xmlns.com/
> foaf/0.1/depiction#Q2">
> >         <rdfs:label>What is the biggest city of Europe?</rdfs:label>
> >     </owl:NamedIndividual>
> >
> >
> >
> >     <!-- http://xmlns.com/foaf/0.1/depiction#Q3 -->
> >
> >     <owl:NamedIndividual rdf:about="http://xmlns.com/
> foaf/0.1/depiction#Q3">
> >         <rdfs:label>What is capital city of Spain?</rdfs:label>
> >     </owl:NamedIndividual>
> >
> >
> >
> >     <!-- http://xmlns.com/foaf/0.1/depiction#Q4 -->
> >
> >     <owl:NamedIndividual rdf:about="http://xmlns.com/
> foaf/0.1/depiction#Q4
> > "/>
> >
> >
> >
> >     <!-- http:dbpedia.org/resource#Berlin -->
> >
> >     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Berlin">
> >         <rdfs:comment>Berlin, Germany’s capital, dates to the 13th
> > century. Reminders of the city&apos;s turbulent 20th-century history
> > include its Holocaust memorial and the Berlin Wall&apos;s graffitied
> > remains. Divided during the Cold War, its 18th-century Brandenburg Gate
> has
> > become a symbol of reunification</rdfs:comment>
> >     </owl:NamedIndividual>
> >
> >
> >
> >     <!-- http:dbpedia.org/resource#London -->
> >
> >     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#London"/>
> >
> >
> >
> >     <!-- http:dbpedia.org/resource#Madrid -->
> >
> >     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Madrid">
> >         <rdfs:comment>Madrid, Spain&apos;s central capital, is a city of
> > elegant boulevards and expansive, manicured parks such as the Buen
> Retiro.
> > It’s renowned for its rich repositories of European art, including the
> > Prado Museum’s works by Goya, Velázquez and other Spanish
> > masters.</rdfs:comment>
> >     </owl:NamedIndividual>
> > </rdf:RDF>
> >
> >
> > <https://www.avast.com/sig-email?utm_medium=email&utm_
> source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
> > Virus-free.
> > www.avast.com
> > <https://www.avast.com/sig-email?utm_medium=email&utm_
> source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > On Thu, Oct 19, 2017 at 11:37 AM, Lorenz Buehmann <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> This is one of the most confusing question I ever read here...
> >>
> >> What is in your ontology? Sample data please! (in Turtle or N-Triples
> >> syntax)
> >>
> >> More comments inline:
> >>
> >>
> >> On 18.10.2017 20:10, javed khan wrote:
> >>> Good day
> >>>
> >>> I want to ask is it possible we access Dbpedia resource  with a
> variable
> >>> name.
> >> Have you tried it?
> >>> For example, we have ontology which include rdfs:comment about
> different
> >>> cities and cities name are in our ontology and store in x variable
> >>>
> >>> ?x rdfs:comment ?y  //This query works for me
> >> It works locally on your ontology - this is not a surprise as long as
> >> the query matches some data.
> >>> Now we want to directly access Dbpedia server (not using ontologiy) for
> >>> these cities and this time we want to access rdfs:abstract, so can we
> use
> >> There is no property rdfs:abstract in the RDFS vocabulary. Dbpedia has
> >> its own ontology, a property that you might mean is
> >> http://dbpedia.org/ontology/abstract
> >>> ?x rdfs:abstract ?sbstract
> >> Typo in variable name...
> >>> If not , how can we access then rdfs:abstract of different cities
> stored
> >> in
> >>> x
> >> Again, why can't you try it out? Is somebody/something preventing you
> >> from sending a SPARQL query to the DBpedia SPARQL endpoint?
> >> The expression "cities stored in x" doesn't make sense - or what is x
> >> for you? the dataset?
> >>
> >> If you have cities in your ontology, then you have to use those URIs as
> >> binding for variable ?x - and this only works if the URIs are the same.
> >> But again, we don't know your data. Alternative would be to match on the
> >> city name, but this is indeed bad practice as city names are ambiguous
> >>
> >>
>
>

Re: How to to access Dbpedia resource using variable

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.

On 19.10.2017 11:34, javed khan wrote:
> Hello Lorenz, I knew I will not be able to explain my point.
>
> I have one class: Question  (What is capital city of Germany)
> Another class : Answer (Berlin)
> and similar question/answers instances.
Are you still working on the quiz project? Have you seen that there is
already related work?
>
> I want to show rdfs:comment of answers like Berlin,Madrid and it works
>
> So when I mentioned ?x  rdfs:comment  ?comment, the ?x contains Answers
> like Berlin, Madrid
>
> After this query if I want to show the rdfs:abstract of Answers (Berlin
> etc) from Dbpedia endpoint directly, is it possible?
To repeat myself, the property rdfs:abstract does **not** exist! There
is a DBpedia property called http://dbpedia.org/ontology/abstract

And why should it not be possible? Send the query with the correct URIs
of the cities to the DBpedia SPARQL endpoint to get the abstracts.

One comment, your URIs do **not** match the URIs of DBpedia!
* you have http://dbpedia.org/resource#London.
* the correct DBpedia URI would be http://dbpedia.org/resource/London
>
> The instances data could be the following in my ontology:
>
> I have one suggestion: Is it possible we are allowed to paste a screen shot
> of our ontology or something else in this group like we do in Protege
> group?
I think it's not possible by the mailing list system - but I'm not an
admin. You could add links that refer image upload services  - as you
should know.
>
> ___________________________
>
>
>
>
>     <!-- http://xmlns.com/foaf/0.1/depiction#Q1 -->
>
>     <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q1">
>         <rdfs:label>What is the capital city of Germany?
> </rdfs:label>
>     </owl:NamedIndividual>
>
>
>
>     <!-- http://xmlns.com/foaf/0.1/depiction#Q2 -->
>
>     <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q2">
>         <rdfs:label>What is the biggest city of Europe?</rdfs:label>
>     </owl:NamedIndividual>
>
>
>
>     <!-- http://xmlns.com/foaf/0.1/depiction#Q3 -->
>
>     <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q3">
>         <rdfs:label>What is capital city of Spain?</rdfs:label>
>     </owl:NamedIndividual>
>
>
>
>     <!-- http://xmlns.com/foaf/0.1/depiction#Q4 -->
>
>     <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q4
> "/>
>
>
>
>     <!-- http:dbpedia.org/resource#Berlin -->
>
>     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Berlin">
>         <rdfs:comment>Berlin, Germany’s capital, dates to the 13th
> century. Reminders of the city&apos;s turbulent 20th-century history
> include its Holocaust memorial and the Berlin Wall&apos;s graffitied
> remains. Divided during the Cold War, its 18th-century Brandenburg Gate has
> become a symbol of reunification</rdfs:comment>
>     </owl:NamedIndividual>
>
>
>
>     <!-- http:dbpedia.org/resource#London -->
>
>     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#London"/>
>
>
>
>     <!-- http:dbpedia.org/resource#Madrid -->
>
>     <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Madrid">
>         <rdfs:comment>Madrid, Spain&apos;s central capital, is a city of
> elegant boulevards and expansive, manicured parks such as the Buen Retiro.
> It’s renowned for its rich repositories of European art, including the
> Prado Museum’s works by Goya, Velázquez and other Spanish
> masters.</rdfs:comment>
>     </owl:NamedIndividual>
> </rdf:RDF>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Thu, Oct 19, 2017 at 11:37 AM, Lorenz Buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> This is one of the most confusing question I ever read here...
>>
>> What is in your ontology? Sample data please! (in Turtle or N-Triples
>> syntax)
>>
>> More comments inline:
>>
>>
>> On 18.10.2017 20:10, javed khan wrote:
>>> Good day
>>>
>>> I want to ask is it possible we access Dbpedia resource  with a variable
>>> name.
>> Have you tried it?
>>> For example, we have ontology which include rdfs:comment about different
>>> cities and cities name are in our ontology and store in x variable
>>>
>>> ?x rdfs:comment ?y  //This query works for me
>> It works locally on your ontology - this is not a surprise as long as
>> the query matches some data.
>>> Now we want to directly access Dbpedia server (not using ontologiy) for
>>> these cities and this time we want to access rdfs:abstract, so can we use
>> There is no property rdfs:abstract in the RDFS vocabulary. Dbpedia has
>> its own ontology, a property that you might mean is
>> http://dbpedia.org/ontology/abstract
>>> ?x rdfs:abstract ?sbstract
>> Typo in variable name...
>>> If not , how can we access then rdfs:abstract of different cities stored
>> in
>>> x
>> Again, why can't you try it out? Is somebody/something preventing you
>> from sending a SPARQL query to the DBpedia SPARQL endpoint?
>> The expression "cities stored in x" doesn't make sense - or what is x
>> for you? the dataset?
>>
>> If you have cities in your ontology, then you have to use those URIs as
>> binding for variable ?x - and this only works if the URIs are the same.
>> But again, we don't know your data. Alternative would be to match on the
>> city name, but this is indeed bad practice as city names are ambiguous
>>
>>


Re: How to to access Dbpedia resource using variable

Posted by javed khan <ja...@gmail.com>.
Hello Lorenz, I knew I will not be able to explain my point.

I have one class: Question  (What is capital city of Germany)
Another class : Answer (Berlin)
and similar question/answers instances.

I want to show rdfs:comment of answers like Berlin,Madrid and it works

So when I mentioned ?x  rdfs:comment  ?comment, the ?x contains Answers
like Berlin, Madrid

After this query if I want to show the rdfs:abstract of Answers (Berlin
etc) from Dbpedia endpoint directly, is it possible?

The instances data could be the following in my ontology:

I have one suggestion: Is it possible we are allowed to paste a screen shot
of our ontology or something else in this group like we do in Protege
group?

___________________________




    <!-- http://xmlns.com/foaf/0.1/depiction#Q1 -->

    <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q1">
        <rdfs:label>What is the capital city of Germany?
</rdfs:label>
    </owl:NamedIndividual>



    <!-- http://xmlns.com/foaf/0.1/depiction#Q2 -->

    <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q2">
        <rdfs:label>What is the biggest city of Europe?</rdfs:label>
    </owl:NamedIndividual>



    <!-- http://xmlns.com/foaf/0.1/depiction#Q3 -->

    <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q3">
        <rdfs:label>What is capital city of Spain?</rdfs:label>
    </owl:NamedIndividual>



    <!-- http://xmlns.com/foaf/0.1/depiction#Q4 -->

    <owl:NamedIndividual rdf:about="http://xmlns.com/foaf/0.1/depiction#Q4
"/>



    <!-- http:dbpedia.org/resource#Berlin -->

    <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Berlin">
        <rdfs:comment>Berlin, Germany’s capital, dates to the 13th
century. Reminders of the city&apos;s turbulent 20th-century history
include its Holocaust memorial and the Berlin Wall&apos;s graffitied
remains. Divided during the Cold War, its 18th-century Brandenburg Gate has
become a symbol of reunification</rdfs:comment>
    </owl:NamedIndividual>



    <!-- http:dbpedia.org/resource#London -->

    <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#London"/>



    <!-- http:dbpedia.org/resource#Madrid -->

    <owl:NamedIndividual rdf:about="http:dbpedia.org/resource#Madrid">
        <rdfs:comment>Madrid, Spain&apos;s central capital, is a city of
elegant boulevards and expansive, manicured parks such as the Buen Retiro.
It’s renowned for its rich repositories of European art, including the
Prado Museum’s works by Goya, Velázquez and other Spanish
masters.</rdfs:comment>
    </owl:NamedIndividual>
</rdf:RDF>


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Oct 19, 2017 at 11:37 AM, Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> wrote:

> This is one of the most confusing question I ever read here...
>
> What is in your ontology? Sample data please! (in Turtle or N-Triples
> syntax)
>
> More comments inline:
>
>
> On 18.10.2017 20:10, javed khan wrote:
> > Good day
> >
> > I want to ask is it possible we access Dbpedia resource  with a variable
> > name.
> Have you tried it?
> > For example, we have ontology which include rdfs:comment about different
> > cities and cities name are in our ontology and store in x variable
> >
> > ?x rdfs:comment ?y  //This query works for me
> It works locally on your ontology - this is not a surprise as long as
> the query matches some data.
> >
> > Now we want to directly access Dbpedia server (not using ontologiy) for
> > these cities and this time we want to access rdfs:abstract, so can we use
> There is no property rdfs:abstract in the RDFS vocabulary. Dbpedia has
> its own ontology, a property that you might mean is
> http://dbpedia.org/ontology/abstract
> >
> > ?x rdfs:abstract ?sbstract
> Typo in variable name...
> >
> > If not , how can we access then rdfs:abstract of different cities stored
> in
> > x
> Again, why can't you try it out? Is somebody/something preventing you
> from sending a SPARQL query to the DBpedia SPARQL endpoint?
> The expression "cities stored in x" doesn't make sense - or what is x
> for you? the dataset?
>
> If you have cities in your ontology, then you have to use those URIs as
> binding for variable ?x - and this only works if the URIs are the same.
> But again, we don't know your data. Alternative would be to match on the
> city name, but this is indeed bad practice as city names are ambiguous
>
>

Re: How to to access Dbpedia resource using variable

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
This is one of the most confusing question I ever read here...

What is in your ontology? Sample data please! (in Turtle or N-Triples
syntax)

More comments inline:


On 18.10.2017 20:10, javed khan wrote:
> Good day
>
> I want to ask is it possible we access Dbpedia resource  with a variable
> name.
Have you tried it?
> For example, we have ontology which include rdfs:comment about different
> cities and cities name are in our ontology and store in x variable
>
> ?x rdfs:comment ?y  //This query works for me
It works locally on your ontology - this is not a surprise as long as
the query matches some data.
>
> Now we want to directly access Dbpedia server (not using ontologiy) for
> these cities and this time we want to access rdfs:abstract, so can we use
There is no property rdfs:abstract in the RDFS vocabulary. Dbpedia has
its own ontology, a property that you might mean is
http://dbpedia.org/ontology/abstract
>
> ?x rdfs:abstract ?sbstract
Typo in variable name...
>
> If not , how can we access then rdfs:abstract of different cities stored in
> x
Again, why can't you try it out? Is somebody/something preventing you
from sending a SPARQL query to the DBpedia SPARQL endpoint?
The expression "cities stored in x" doesn't make sense - or what is x
for you? the dataset?

If you have cities in your ontology, then you have to use those URIs as
binding for variable ?x - and this only works if the URIs are the same.
But again, we don't know your data. Alternative would be to match on the
city name, but this is indeed bad practice as city names are ambiguous