Example of JavaScript query DBpedia

Source: Internet
Author: User

This article describes how to use Sparqlwrapper.js to read DBpedia data and display it.

Objective of this article: Enter an English word and return the relevant information in the wiki.

The main problem to be solved in this paper is what kind of SPARQL statement can find out what we need.

First look at a simple SPARQL query statement

PREFIX:  

First, define a domain namespace http://aabs.purl.org/music#.

Then choose such a instrument variable that he satisfies:

The subject is http://aabs.purl.org/music#andrew, the predicate is http://aabs.purl.org/music#playsInstrument, the object is the instrument.

Bif:contains ()

Bif:contains () is a variant function of the CONTAINS () function, as the name implies, to determine whether or not a function is included.

Using this we can find the data we need.

Prefix foaf:  

The SPARQL statement is the query that contains the name of the term, and then returns the URL of the picture, the URL of the homepage, and the profile.

Let's finish writing the whole program below.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.