sparql

There are seems to be also some tools to visualize data by accessing to a SPARQL endpoint (e.g. Apache Jena Fuseki provides the possibility to have a SPARQL endpoint, in addition to publicly available SPARQL endpoints, if that's of an interest). This might be a bit off-topic, but I hope at least related to your challenge :)

Apparently sparql doesn't allow non aggregate variables in the select clause unless they are also in the group by, which affects the query's meaning. So I came up with another solution which includes an intersection(join):

select ?country ?area ?lake
where {
?lake rdfs:label ?label .
?lake rdf:type dbo:Lake .
?lake dbo:areaTotal ?area .
?lake dbo:country ?country .
?country rdf:type dbo:Country .
FILTER (lang(?label) = 'en') .
FILTER(?maxarea = ?area)
{
select ?country (MAX(?area) AS ?maxarea)
where {
?lake rdfs:label ?label .
?lake rdf:type dbo:Lake .
?lake dbo:areaTotal ?area .
?lake dbo:country ?country .
?country rdf:type dbo:Country .
FILTER (lang(?label) = 'en') .
}
group by ?country
}
}

Technology:

SPARQL group by only one variable

In semantic web, sparql is a powerful language which can among others query for specific knowledge from provided rdf databases. Recently I tried to find out the largest lake in each country in the world from dbpedia. I came up with a query which resulted in the country and the area of its largest lake but without the name of the lake. I wanted to list the name of the lake in the table. So when I added a new variable to the select clause without putting it in group by clause, it complained that "Variable ?label is used in the result set outside aggregate and not mentioned in GROUP BY clause".

Calais Tags:

RDF query language

An RDF query language is a computer language, specifically a query language for databases, able to retrieve and manipulate data stored in Resource Description Framework format.
SPARQL is emerging as the factor of RDF query language, and is a W3C recommendation.but there is other query languages like:

DQL, XML-based
N3QL
R-DEVICE
RDFQ, XML-based
RDQ, SQL-like
RDQL, SQL-like
RQL/RVL, SQL-like
SeRQL, SQL-like,

Example:Cities in Austria the name of which starts with the string "Ober"

SELECT ?L
WHERE
{
?C rdfs:label ?L ;
http://dbpedia.org/ontology/country
http://dbpedia.org/resource/Austria .
FILTER ( regex(str(?L),"^Ober"))
}

How to store ontologies in a relational database?

The Semantic Web brings closer to realization the possibility of semantically organized data repositories, or ontologies, throughout the Internet that can be used for intelligent information searching both by humans and computational agents. Ontologies are important to application integration solutions. However, while today there is an un-precedented wealth of information available on the Web, to fully realize the power of ontologies and to enable efficient and flexible information gathering, persistent storage of ontologies and its subsequent retrieval is of paramount importance. Therefore, storing ontologies in a relational database is one way to get around this problem.
Subscribe to sparql