project-pheme / project-pheme-data-interface

Other
0 stars 0 forks source link

Reducing duplicates of tweeted images and summarizing by retweet count #17

Closed tuxpiper closed 8 years ago

tuxpiper commented 8 years ago

Trying to keep a list of threads were that image appears

lauratolosi commented 8 years ago

I am not sure this is exactly what you are searching for. But these are the unique images, by theme:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pheme: <http://www.pheme.eu/ontology/pheme#>
PREFIX dlpo: <http://www.semanticdesktop.org/ontologies/2011/10/05/dlpo#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?a ?date ?eventId ?thread ?text ?imageURL where {   
    ?a pheme:eventId ?eventId.
    ?a pheme:createdAt ?date .
    ?a sioc:has_container ?thread .
    ?a pheme:hasEvidentialityPicture ?imageURL .
    #?a pheme:eventId "2045". # if you want to restrict to a particular event
    ?a dlpo:textualContent ?text.
    ?a pheme:version "v7"
} #order by desc(xsd:integer(?eventId))
order by desc(?date)
limit 100
lauratolosi commented 8 years ago

Also, this one adds multiplicity, how many times an image is linked in a theme. I guess you can sort them by this numerical value.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pheme: <http://www.pheme.eu/ontology/pheme#>
PREFIX dlpo: <http://www.semanticdesktop.org/ontologies/2011/10/05/dlpo#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?eventId ?imageURL (count(?imageURL) as ?countImage) where {   
    ?a pheme:eventId ?eventId.
    ?a pheme:createdAt ?date .
    #?a sioc:has_container ?thread .
    ?a pheme:hasEvidentialityPicture ?imageURL .
    FILTER(?date > "2016-07-28T07:00:00"^^xsd:dateTime)
    #?a pheme:eventId "2045". # if you want to restrict to a particular event
    #?a dlpo:textualContent ?text.
    ?a pheme:version "v7"
} group by ?eventId ?imageURL
order by desc(xsd:integer(?eventId)) desc(?countImage)
limit 100
lauratolosi commented 8 years ago

A quick quesrion: is it ok to have separate queries for this information? If you think it's important to have it fetched directly with everything else on the dashboard's Themes screen, I will have to ask Nasko or my GraphDB colleagues for a more elaborate query.

tuxpiper commented 8 years ago

@lauratolosi the only thing would be all the threads where each image url appears, but I think we don't need to run an expensive query all the time to get that. A separate query would be fine.