Freebase Query Limit - freebase

I have been trying to query freebase (on freebase.com) for all instances of /organization/organization
[{
"type": "/organization/organization",
"name": null,
"mid": null,
"limit": 1,000,000
}]
but no matter how much limit i put I get maximum result of 100,000. I wish to get list of all topics. Is there a way to circumnavigate that?
Thank you!

Google has a limit of 100k quota. It wasnt mentioned on freebase.com. It was mentioned on the google freebase page!

Related

Using multiple consumers with CosmosDB change feed

I am trying to use cosmos db change feed (I'm referring to https://learn.microsoft.com/en-us/azure/cosmos-db/change-feed-processor and https://github.com/Azure/azure-cosmos-dotnet-v2/tree/master/samples/code-samples/ChangeFeedProcessorV2).
When I start a multiple instances of a consumer, the observer seems to see only 1 partition key range. I only see a message - Observer opened for partition Key Range 0 and it starts receiving the change feed. So, the feed is received by only 1 consumer at any given point. If I close one consumer, the next one picks up happily.
I can't seem to understand the partition keys / ranges in cosmos db. In cosmos db, I've created a database and a collection within it. I've defined a partition key - /myId. I store a unique guid in myId. I've saved about 10000 transactions in the collection.
When I look at partition key ranges using api (/dbs/db-name/colls/coll-name/pkranges), I see only node under PartitionKeyRanges. Below is the output I see
{
"_rid": "LEAgAL7tmKM=",
"PartitionKeyRanges": [
{
"_rid": "LEAgAL7tmKMCAAAAAAAAUA==",
"id": "0",
"_etag": "\"00007d00-0000-0000-0000-5c3645e70000\"",
"minInclusive": "",
"maxExclusive": "FF",
"ridPrefix": 0,
"_self": "dbs/LAEgAA==/colls/LEAgAL7tmKM=/pkranges/LEAgAL7tmKMCAAAAAAAAUA==/",
"throughputFraction": 1,
"status": "online",
"parents": [],
"_ts": 1547060711
}
],
"_count": 1
}
Shouldn't this show more partition key ranges? Is this behavior expected?
How do I get multiple consumers to receive data as shown under https://learn.microsoft.com/en-us/azure/cosmos-db/change-feed-processor?
TL;DR - you should be able to ignore partition key ranges and the number of them you have and just let Change Feed Processor manage that for you.
The partition key ranges is an implementation detail we currently leak. The short answer is we add new partition key ranges when we want to restructure how your data is stored in the backend. This can happen for lots of reasons, like you add more data, you consume a lot of RUs for a subsection of that data, or we just want to shuffle things around. Theoretically, if you kept adding data, we'd eventually split the range in two.
We're working on some updates for the v3 SDKs that are currently in preview to abstract this a bit further, since even the answer I have given above is pretty hand wavey and we should have a more easily understood contract for public APIs.

How do I query unique documents from a meteor collection and avoid duplicates?

I have a collection that contains thousands of documents in this form:
{
"_id": "wMRHDpb53RhhjxXj4",
"institution": "uw.edu",
"campus": "seattle",
"quarter": "SUMMER",
"department": "CHEM",
"course": "CHEM321",
"section": "A",
"ISBN": "",
"createdAt": {
"$date": "2017-08-13T18:20:40.923Z"
},
"ilendBooksId": "none",
"ilendbooksId": "none"
}
Each document represents a course at my school.
EDIT: I have multiple documents that share every field except the date created. Based on that, what is the best solution?
I only want one document of each document that may exist of a different course. Can someone please help me? Thank you!
There is a mongo query identifier, called .distinct() that supports retrieving unique entries. So you can e.g. retrieve all possible names of courses without duplicates.
Unfortunately it is only implemented in more recent mongo versions and yet not supported in minimongo (the client side implementation of mongodb in meteor).
If there is progress on that, this answer will be updated. Please comment, if this is deprecated.
However, there is already an open github feature request on that.

How to increase a value in Firebase Realtime Database?

I have this simple struct:
{
"items": {
"item1": {
"likes": 4
},
"item2": {
"likes": 5
}
}
}
I enable offline mode:
Firebase.getDefaultConfig().setPersistenceEnabled(true);
Multiple users can increase the "likes" fields at the same time. How can I increase the likes filed by 1 in offline mode? If I get the likes value than set it with the increased value, what happens it the device reaches the server but another users before that have increased the same likes field? Will it overwite the value?
I can imagine my data structure is not so good because I'm new to NoSQL. I can add Firebase userids to the likes fields instead of a counter integer and summarize them to get the result. But this means lots of unneccessary data beacuse I don't need to know who liked I just need the number of likes.
Please help me to find out the best solution! Thank you!

freebase - get description of person

I have the following MQL query which successfully returns the record for William Shakespeare.
[{
"/type/object/name": null,
"/type/object/id": "/en/william_shakespeare"
}]​
http://tinyurl.com/cnpma3f
I am trying to get the description attribute. When I add "description": null, I get a 'no description attribute found' error. Yet, looking at the record in freebase, it should be there:
http://www.freebase.com/experimental/topic/standard/en/william_shakespeare
The topic API aggregates results across a number of Freebase services; the descriptions are stored separately from the other data about a topic and you'll have to use the text service to fetch them, rather than MQL directly.
As an aside, you should probably consider changing to the new Freebase APIs; those hosted at (www|api).freebase.com are deprecated and will (allegedly) be turned off in October.

Sorting Order of Freebase MQL Read Service results

I am trying to get a list of items using a list of MIDs
Previously I asked this question Array of Freebase MIDs and sending multiple queries to freebase
So my MQL query looks like this now:
[{
"mid": null,
"name": null,
"topics:mid|=":[
"/m/045c7b",
"/m/0d6lp",
"/m/021ympy",
...
]
}]
Sample MQL Query URL
However, the default order seems to be based on something like index or timestamp. I would like the order of the results to mirror the order the MIDs are listed in the query - is this possible? If so, any hints on what the MQL would look like would be awesome :)
Not possible with MQL - you'll have to do the sorting client-side. For what it's worth, the default order is undefined, so don't rely on it for anything.

Resources