Sparql search engine queries



By Pim Keizer

A simple example of some generic sparql queries for use in a  search engine.

Search phrase:    “Adidas”

 Instance match

Select all instances with label "Adidas".

 

SELECT *

WHERE {

    ?resource rdfs:label "Adidas" .

}

 

Find synonyms

Select all classes that are of the same type.

SELECT ?synonyms

WHERE {

    ?resource rdfs:label "Adidas" .

    ?resource rdf:type ?type .

    ?synonyms rdf:type ?type .

}

 

Find other instances with the same type

Select all instances of the current type.

SELECT ?otherInstances

WHERE {

    ?resource rdfs:label "Adidas" .

    ?resource rdf:type ?type .

    ?objProp rdfs:range ?type  .

    ?otherInstances ?objProp ?resource .

}

 

Find other classes with the same properties

Select all classes with the same properties as the current instance with :label "Adidas".

SELECT ?otherClasses

WHERE {

    ?resource rdfs:label "Adidas" .

    ?resource rdf:type ?type .

    ?objProp rdfs:range ?type  .

    ?otherInstances ?objProp ?resource .

    ?otherInstances rdf:type ?otherClasses .

}

One Trackback

  • 26 Oct 2010 | Permalink |

    Palapple Blog | SEO Solutions for your Business…

    Thanks for sharing. Search engine optimization is indeed one of the most crucial areas in Internet marketing, it is a perfect bridge between technology and business….