Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:14:46+00:00 2026-06-01T00:14:46+00:00

I am sure what I want to do is very easy, yet I cannot

  • 0

I am sure what I want to do is very easy, yet I cannot seem to get the query right. I have records in dataset which have values such as city name e.g. ‘New York’ and it’s corresponding country code e.g ‘US’. I also have access to the full country name and country ISO codes.

I would like to get the population and abstract value’s for these cities off dbpedia, by using a where clause such as:

Get population where name = "New York" and isoCountryCode = "US"

I’ve searched for help on this to no avail.

so far I have been kindly helped by @rohk with this query, which does not fully work for all locations:

SELECT DISTINCT ?city ?abstract ?pop
WHERE {
   ?city rdf:type schema:City ;
     rdfs:label ?label ;
     dbpedia-owl:abstract ?abstract ;
     dbpedia-owl:country ?country ;
     dbpedia-owl:populationTotal ?pop .
   ?country dbpprop:countryCode "USA"@en .
   FILTER ( lang(?abstract) = 'en' and regex(?label, "New York City"))
 }

The above works for New York, however when I change it to:

SELECT DISTINCT ?city ?abstract ?pop
WHERE {
   ?city rdf:type schema:City ;
         rdfs:label ?label ;
         dbpedia-owl:abstract ?abstract ;
         dbpedia-owl:country ?country ;
         dbpedia-owl:populationTotal ?pop .
   ?country dbpprop:countryCode "THA"@en .
   FILTER ( lang(?abstract) = 'en' and regex(?label, "Bangkok"))
}

It returns no results for Bangkok, Thailand.

I just cant seem to get the SPARQL query correct, I’m sure I am being silly with my query. If any guru’s could provide me with help I’d appreciate it. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:14:47+00:00Added an answer on June 1, 2026 at 12:14 am

    This query is working

    SELECT DISTINCT *
    WHERE {
       ?city rdf:type schema:City ;
             rdfs:label ?label ;
             dbpedia-owl:abstract ?abstract ;
             dbpedia-owl:country ?country ;
             dbpprop:website ?website ;
             dbpedia-owl:populationTotal ?pop .
       ?country dbpprop:countryCode "USA"@en .
       FILTER ( lang(?abstract) = 'en' and regex(?label, "New York City"))
    }
    

    EDIT : For Bangkok, there are 2 problems :

    • No country code for Thailand : you can use rdfs:label "Thailand"@en instead.
    • rdf:type of Bangkok is not schema:City but dbpedia-owl:Settlement

    Here is a working query for Bangkok

    SELECT DISTINCT *
    WHERE {
       ?city rdf:type dbpedia-owl:Settlement ;
             rdfs:label "Bangkok"@en ;
             dbpedia-owl:abstract ?abstract ;
             dbpedia-owl:populationTotal ?pop ;
             dbpedia-owl:country ?country ;
             dbpprop:website ?website .
       ?country rdfs:label "Thailand"@en .
       FILTER ( lang(?abstract) = 'en' )
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For sure this question is very easy, but I just cannot figure this out.
I'm sure this would be something very easy but I'm unable to sort it
I'm sure this is very easy but I'm getting tied in a knot with
I know this is probably very easy, but I want to add sprites in
I am sure this is an easy thing to do. I am very new
I want to make sure I want to optimize and make my site very
I am building a web widget which will be very easy to integrate. Say
I am pretty sure this is very easy and that I am only missing
I'm sure this is possible -- and probably very easy -- but I can't
For the following code <script type=text/javascript> $(document).ready(function(){ $(#erase).click(function(){ confirm('Are you sure you want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.