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 8906095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:33:46+00:00 2026-06-15T02:33:46+00:00

I have build a sparql query for dbpedia with a regex in it which

  • 0

I have build a sparql query for dbpedia with a regex in it which is very slow :

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbpedia-owl:<http://dbpedia.org/ontology/>

select ?label where {
    ?s rdfs:label ?label.
    ?s dbpedia-owl:thumbnail ?photo.
    ?s dbpedia-owl:abstract ?abstract.
    FILTER langMatches( lang(?label), "FR" ).
    FILTER langMatches( lang(?abstract), "FR" ).
    FILTER regex(?label, "^Jules V", "i").

}
LIMIT 10

You can try it using the public endpoint http://fr.dbpedia.org/sparql and see you have to wait some seconds.

Is there a way for me to get better performance on this, even if the final quality is not so good ?

Thanks,
Samuel

  • 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-15T02:33:47+00:00Added an answer on June 15, 2026 at 2:33 am

    Any query using REGEX will almost certainly be slow unless your query restricts to a small enough portion of the dataset. Processing a REGEX basically requires that the store do a linear scan over the potential results checking each to see whether it matches the regular expression.

    If you have a sufficiently simple regular expression as in your case you should try one of two things:

    Solution 1 – Use a lighter weight string function

    In your case you’re looking for strings that start with a certain substring, so it will almost certainly be more efficient to use the STRSTARTS function instead since that doesn’t require full regex. This of course assumes your SPARQL engine complies with the latest SPARQL 1.1 draft specification.

    Solution 2 – Use Full Text Search

    Many stores include full text search extensions which can be used in place of REGEX and often yield significantly better performance because you are accessing a full text index rather than doing a linear scan over the potential results.

    In the case of DBPedia the Virtuoso store behind it supports the following syntax:

    ?label bif:contains "Jules"
    

    Note that the Virtuoso full text syntax is somewhat limited so you can’t use Jules V as is because each term must be at least 4 characters (possibly 3). But you can combine this with a further FILTER to narrow down to the results you wanted like so:

    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX dbpedia-owl:<http://dbpedia.org/ontology/>
    
    select ?label where {
        ?s rdfs:label ?label.
        ?s dbpedia-owl:thumbnail ?photo.
        ?s dbpedia-owl:abstract ?abstract.
        FILTER langMatches( lang(?label), "FR" ).
        FILTER langMatches( lang(?abstract), "FR" ).
        ?label bif:contains "Jules" .
        FILTER (CONTAINS(?label, "V"))
    
    }
    LIMIT 10
    

    This query runs almost instantaneously

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have build the a word cloud (you can check it out at http://www.cybernetiksolutions.com/wordcloud
I have build my very first application to Android and I want now to
I have build a web application which shows the list of customers using datalist
I have build an Android application which capture images and save in the /mnt/sdcard/Pictures/MyFolder
I have build a grails application, which on login redirects users to different URLs
I have build an C# Winforms application which will need regular updates and patches
We already have build scripts that creates our web application folders very nicely. We
I have build a little function which returns a jQuery plugin applied to a
I have build one application in which I want to load SWF file build
I have build the following application: http://codecanyon.net/item/secure-login-system/1379963 , and I got some requests for

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.