EventRegistry / event-registry-python

Python package for API access to news articles and events in the Event Registry
http://eventregistry.org/
MIT License
232 stars 54 forks source link

0 results #45

Closed jmy48 closed 5 years ago

jmy48 commented 5 years ago

Hi, I'm just trying to do a standard concept query and I'm getting 0 results. What am I doing wrong?

` TRAINING_STARTDATE = date(year = 2014, month = 1, day = 1) TRAINING_ENDDATE = date(year = 2019, month = 3, day = 13)

def query(outfile, params): q = QueryArticles( keywords = params["keywords"], conceptUri = "https://en.wikipedia.org/wiki/Apple_Inc.", categoryUri = params["categories"], sourceUri = params["sources"], sourceLocationUri = None, sourceGroupUri = None, authorUri = None, locationUri = None, lang = "eng", dateStart = TRAINING_ENDDATE - datetime.timedelta(days=7), dateEnd = TRAINING_ENDDATE, dateMentionStart = None, dateMentionEnd = None, keywordsLoc = "title", ignoreKeywords = None, ignoreConceptUri = None, ignoreCategoryUri = None, ignoreSourceUri = None, ignoreSourceLocationUri = None, ignoreSourceGroupUri = None, ignoreAuthorUri = None, ignoreLocationUri = None, ignoreLang = None, ignoreKeywordsLoc = "body", isDuplicateFilter = "keepAll", hasDuplicateFilter = "keepAll", eventFilter = "keepAll", startSourceRankPercentile = params["rankStart"], #experiment with this endSourceRankPercentile = params["rankEnd"], dataType = ["news", "pr", "blogs"])

r = ReturnInfo(articleInfo = ArticleInfoFlags(
    bodyLen = -1,
    title = True,
    basicInfo = True,
    body = True,
    url = True,
    eventUri = True,
    authors = True,
    concepts = True,
    categories = True,
    links = False,
    videos = False,
    image = False,
    socialScore = True,
    sentiment = True,
    location = False,
    dates = False,
    extractedDates = False,
    duplicateList = False,
    originalArticle = False,
    storyUri = False))

articles = RequestArticlesInfo(
    page = 1, 
    count = 100, 
    sortBy = "date",
    sortByAsc = False,
    returnInfo = r
    )

uris = RequestArticlesUriWgtList(
    page = 1,
    count = 50000,
    sortBy = "")

time = RequestArticlesTimeAggr()

q.setRequestedResult(articles)

results = er.execQuery(q) 
print(results)

with open(outfile, "w") as fp:
    json.dump(results, fp)

if name == "main":

query("./data/test.json", {
    "keywords": "Apple",
    "concepts": "https://en.wikipedia.org/wiki/Apple_Inc.",
    "categories": None,
    "sources": None,
    "rankStart": 0,
    "rankEnd": 100
}

`

jmy48 commented 5 years ago

Just found out what the problem was: my uri wikpedia link has an "https://..." not an "http://.."!