project-pheme / project-pheme-data-interface

Other
0 stars 0 forks source link

Image URL provided by GraphDB is not the image itself #3

Closed tuxpiper closed 8 years ago

tuxpiper commented 8 years ago

In graphdb the url for image evidentiality is stored as something like:

http://twitter.com/DaystoTrump/status/748327740143636480/photo/1

which is a whole HTML document, displaying the image in the context of the thread, instead of the image itself, which would be:

http://pbs.twimg.com/media/CmIuxsJWkAAEUZa.png

Both URLs are provided by twitter in their data model, we would need GraphDB to store the media_url property.

{
  "contributors": null,
  "coordinates": null,
  "created_at": "Thu Jun 30 01:30:11 +0000 2016",
  "entities": {
    "hashtags": [
      {
        "indices": [
          12,
          18
        ],
        "text": "Trump"
      },
      {
        "indices": [
          64,
          74
        ],
        "text": "Trump2016"
      },
      {
        "indices": [
          75,
          86
        ],
        "text": "TrumpTrain"
      },
      {
        "indices": [
          87,
          109
        ],
        "text": "MakeAmericaGreatAgain"
      },
      {
        "indices": [
          110,
          115
        ],
        "text": "MAGA"
      }
    ],
    "media": [
      {
        "display_url": "pic.twitter.com/TVmXRNRNni",
        "expanded_url": "http://twitter.com/DaystoTrump/status/748327740143636480/photo/1",
        "id": 748211919295778800,
        "id_str": "748211919295778816",
        "indices": [
          116,
          139
        ],
        "media_url": "http://pbs.twimg.com/media/CmIuxsJWkAAEUZa.png",
        "media_url_https": "https://pbs.twimg.com/media/CmIuxsJWkAAEUZa.png",
        "sizes": {
          "large": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "medium": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "small": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "thumb": {
            "h": 150,
            "resize": "crop",
            "w": 150
          }
        },
        "type": "photo",
        "url": "https://t.co/TVmXRNRNni"
      }
    ],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "extended_entities": {
    "media": [
      {
        "display_url": "pic.twitter.com/TVmXRNRNni",
        "expanded_url": "http://twitter.com/DaystoTrump/status/748327740143636480/photo/1",
        "id": 748211919295778800,
        "id_str": "748211919295778816",
        "indices": [
          116,
          139
        ],
        "media_url": "http://pbs.twimg.com/media/CmIuxsJWkAAEUZa.png",
        "media_url_https": "https://pbs.twimg.com/media/CmIuxsJWkAAEUZa.png",
        "sizes": {
          "large": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "medium": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "small": {
            "h": 326,
            "resize": "fit",
            "w": 648
          },
          "thumb": {
            "h": 150,
            "resize": "crop",
            "w": 150
          }
        },
        "type": "photo",
        "url": "https://t.co/TVmXRNRNni"
      }
    ]
  },
  "favorite_count": 84,
  "favorited": false,
  "geo": null,
  "id": 748327740143636500,
  "id_str": "748327740143636480",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "lang": "en",
  "place": null,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "retweet_count": 78,
  "retweeted": false,
  "source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>",
  "text": "132 Days to #Trump : Counting down to the election in November! #Trump2016 #TrumpTrain #MakeAmericaGreatAgain #MAGA https://t.co/TVmXRNRNni",
  "truncated": false,
  "user": {
    "contributors_enabled": false,
    "created_at": "Mon Feb 15 16:54:15 +0000 2016",
    "default_profile": false,
    "default_profile_image": false,
    "description": "Counting down to Election Day and a #GreatAmerica with @realDonaldTrump. Not an official campaign account. Let's #MakeAmericaGreatAgain! #Trump2016 #Trump",
    "entities": {
      "description": {
        "urls": []
      },
      "url": {
        "urls": [
          {
            "display_url": "makeamericagreatclock.com",
            "expanded_url": "http://www.makeamericagreatclock.com",
            "indices": [
              0,
              23
            ],
            "url": "https://t.co/zQBK9EEENX"
          }
        ]
      }
    },
    "favourites_count": 5328,
    "follow_request_sent": false,
    "followers_count": 13615,
    "following": false,
    "friends_count": 14968,
    "geo_enabled": false,
    "has_extended_profile": false,
    "id": 4914539795,
    "id_str": "4914539795",
    "is_translation_enabled": false,
    "is_translator": false,
    "lang": "en",
    "listed_count": 76,
    "location": "A Great America",
    "name": "Days To Trump",
    "notifications": false,
    "profile_background_color": "2C324C",
    "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_tile": false,
    "profile_banner_url": "https://pbs.twimg.com/profile_banners/4914539795/1455631468",
    "profile_image_url": "http://pbs.twimg.com/profile_images/699343284984897537/uzGIQT6k_normal.png",
    "profile_image_url_https": "https://pbs.twimg.com/profile_images/699343284984897537/uzGIQT6k_normal.png",
    "profile_link_color": "313A7A",
    "profile_sidebar_border_color": "000000",
    "profile_sidebar_fill_color": "000000",
    "profile_text_color": "000000",
    "profile_use_background_image": false,
    "protected": false,
    "screen_name": "DaystoTrump",
    "statuses_count": 3397,
    "time_zone": null,
    "url": "https://t.co/zQBK9EEENX",
    "utc_offset": null,
    "verified": false
  }
}
lauratolosi commented 8 years ago

Nasko will change this soon :)

lauratolosi commented 8 years ago

it's changed already, has been retrieving the correct property for a while now. Check this query, where the most recent images are shown:

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
tuxpiper commented 8 years ago

Thank you @lauratolosi !