I have a problem here, it looks easy but because I am not really familiar with Sparal queries I could not find a solution for it.
PREFIX onto: <http://dbpedia.org/ontology/>
PREFIX resu: <http://dbpedia.org/resource/>
PREFIX yago: <http://dbpedia.org/class/yago/>
SELECT
count(?MontrealC) as ?Montrea
count(?TorontoC) as ?Toronto
count(?OttawaC) as ?Ottawa
count(?VancouverC) as ?Vancouver
WHERE
{
{?MontrealC rdf:type yago:HotelsInMontreal} UNION
{?TorontoC rdf:type yago:HotelsInToronto} UNION
{?OttawaC rdf:type yago:HotelsInOttawa} UNION
{?VancouverC a onto:Hotel .
{?VancouverC onto:location resu:Vancouver} UNION
{?VancouverC onto:location ?street .
?street a yago:StreetsInVancouver}} UNION
{?VancouverC a yago:HotelsInBritishColumbia .
{?VancouverC onto:location resu:Vancouver} UNION
{?VancouverC onto:location ?street.
?street a yago:StreetsInVancouver}
}}
Once you apply this query in any dbpedia endpoint you will get a result shown in tow rows and four columns as the following:
Montreal Toronto Ottawa Vancouver
8 28 5 10
The problem is I need them to be in tow Columns and four rows same as the following:
Montreal Toronto
8 28
Ottawa Vancouver
5 10
Is that something possible in SPARQL queries?