Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Ontology SPARQL basic query

What are the advantages of SPARQL?

  • SPARQL can fetch results/data from structured and semi-structured data.
  • SPARQL can handle complex joins and relationships
  • SPARQL can help to find the data by running queries of unknown relationships.
  • SPARQL can transform RDF data into different vocabulries.

What is mean by RDF triples?

RDF triples are

  1. Subject
  2. Predicate
  3. Object

What are literals?

Literal is the lexical representation of values such as numbers and dates. 

A literal can be the object but it can’t be subject or predicate.

Representation of literals = Representation of URI

?S ?P ?O
limit 10


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
?person a foaf:Person.
?person foaf:name ?name

Note: It will show the name of from the DBpedia database. Output can be like this;




Akram is the name of the person and en indicates that Akram name is a word of English languages.

Example 2:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?age
?person a foaf:Person;
foaf:name ?name.
OPTIONAL {?person foaf:age ?age}


Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.

Leave a Reply

Your email address will not be published. Required fields are marked *