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.