Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPARQL query for partial match of statement (contains)

Tags:

sparql

I would like to know if there is a way in SPARQL to query for partial matches of statements. So if for example in the triple store I have an object containing "blablablaUsefulblablabla" I would like to be able to query for Useful, so I want to say that the statement "Useful" should be found, independent of what is before or after this statement.

Is there a way to do this?

Thanks

like image 511
RobinAugy Avatar asked Feb 20 '15 11:02

RobinAugy


People also ask

What is a SPARQL query?

SPARQL queries contain triple patterns, much like the data itself, which utilise the relationships to quickly navigate any linked data. This language is common for all linked data so queries can traverse across multiple RDF databases at once. Query 7 in the next section is an example of this powerful characteristic.

Is there a way to match triples in SPARQL?

So we actually want to be able to match triples if either rdfs:label or skos:altLabel equal the name of the player. I thought there might be a way to write an OR clause within the WHERE block, but as I understand it, the way to achieve this in SPARQL is via a UNION statement.

What are SPARQL filters?

•SPARQL FILTERs eliminate solutions that do not cause an expression to evaluate to true. •Place FILTERs in a query inline within a basic graph pattern Category Functions / Operators Examples

What is contains in SQL Server?

CONTAINS is a predicate used in the WHERE clause of a Transact-SQL SELECT statement to perform SQL Server full-text search on full-text indexed columns containing character-based data types. CONTAINS can search for:


1 Answers

I have an object containing "blablablaUsefulblablabla"

If I understand you correctly, it sounds like you want the contains function. E.g., on DBpedia:

select distinct ?city ?label where {
  ?city a dbpedia-owl:City ;
        rdfs:label ?label .
  filter contains(?label,"San")         #-- the important line
  filter langMatches(lang(?label),'en')
}
limit 100

SPARQL results

like image 92
Joshua Taylor Avatar answered Oct 21 '22 21:10

Joshua Taylor