mercredi 4 février 2015

INTEGRATING QUERIES IN SPRQL


Vote count:

0




All queries are tested on sparql virtuso endpoint

I want to find the categories of two dbpedia subject like here Bharatiya_Janata_Party and New_Delhi.

I want to match how the categories of these are similar to each other.


As here in the first query i got the categories of Bharatiya_Janata_Party.


In the Second query i got the categories of New_Delhi.


Now I want to match the result of category of Bharatiya_Janata_Party to that of New_Delhi. Like here



  1. Nationalist_parties---New_Delhi

  2. Nationalist_parties---New_Delhi_district

  3. Nationalist_parties---Populated_places_established_in_1911

  4. Nationalist_parties---Capitals_in_Asia

  5. Nationalist_parties---Capitals_in_Asia

  6. Nationalist_parties--Planned_capitals

  7. Political_parties_established_in_1980---New_Delhi

  8. Political_parties_established_in_1980---New_Delhi_district

  9. .....

  10. .... .. ..


I have fired a query III for making match between Nationalist_parties---New_Delhi. I got a match at level 4((^skos:broader){0,4}).


Similarly Again I have to do for Nationalist_parties---New_Delhi_district.


The real problem is that i want to combine these 3 queries so that i may get the direct result in a tabular form. Is there any way to automate the whole process.


Query I:



SELECT *
WHERE {
dbpedia:Bharatiya_Janata_Party dcterms:subject ?x
}


Result of Query I:



http://ift.tt/1KfMSgu
http://ift.tt/16Dt48B
http://ift.tt/1KfMQVG
http://ift.tt/16Dt4W1
http://ift.tt/1KfMSwK
http://ift.tt/16Dt740
http://ift.tt/1KfMQVP


Query II:



SELECT *
WHERE {
dbpedia:New_Delhi dcterms:subject ?x
}


Result of Query II:



http://ift.tt/16Dt5co
http://ift.tt/1KfMSwW
http://ift.tt/1KfMQVV
http://ift.tt/16Dt743
http://ift.tt/16Dt5cu
http://ift.tt/1KfMSNg
http://ift.tt/16Dt748


QUERY III:



select distinct ?super where {
?super (^skos:broader){0,4} category:Nationalist_parties, category:New_Delhi
}


Result:



http://ift.tt/1KfMSNo
http://ift.tt/16Dt74c


First Match at level 4 with 2 Super Classes


P.S: It is not necessary that the other query will match at (^skos:broader){0,4}. So i am manually firing the above query from (^skos:broader){0,0} and incrementing as (^skos:broader){0,1}->(^skos:broader){0,2)...to the first match.



select distinct ?super where {
?super (^skos:broader){0,6} category:Nationalist_parties, category:New_Delhi_district
}


Result:



http://ift.tt/1KfMSNr
http://ift.tt/16Dt74c
http://ift.tt/16Dt5cw
http://ift.tt/1KfMSNw


First Match at level 6 with 4 Super Classes


===================================


Combining these 3 queries i want this type of result in a tabular form:-


==================================


**CategoryI(QueryI---Category(QuesryII)---Level --count matches*



  1. Nationalist_parties---New_Delhi---------------------------- 4------ 2

  2. Nationalist_parties---New_Delhi_district-------------------6--------4

  3. Nationalist_parties---Populated_places_established_in_1911

  4. Nationalist_parties---Capitals_in_Asia

  5. Nationalist_parties---Capitals_in_Asia ...

  6. .....

  7. ....


Please help me to automate and combine the above query. I have read several posts but not able to figure it how.



asked 18 secs ago







INTEGRATING QUERIES IN SPRQL

Aucun commentaire:

Enregistrer un commentaire