Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need documentation to query an entity #47

Open
ganeshkmurthy opened this issue Dec 30, 2018 · 2 comments
Open

Need documentation to query an entity #47

ganeshkmurthy opened this issue Dec 30, 2018 · 2 comments
Assignees
Milestone

Comments

@ganeshkmurthy
Copy link

ganeshkmurthy commented Dec 30, 2018

I am looking for a way to query an entity using the name and finding the QID for it. Can someone point me to an example? Thanks!

Here is what I have so far. I am able to fetch an entity using QID, but I am looking to fetch an entity by it's name.

// A WikiClient has its own CookieContainer.
var client = new WikiClient
{
ClientUserAgent = "WCLQuickStart/1.0 (your user name or contact information here)"
};

var myWikiDataSite = new WikiSite(client, "https://www.wikidata.org/w/api.php");
try
{
await myWikiDataSite.LoginAsync(Username, Password);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

try
{
await myWikiDataSite.Initialization;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

var entity = new Entity(myWikiDataSite, "Q60204555");
await entity.RefreshAsync( EntityQueryOptions.FetchAllProperties);

await myWikiDataSite.LogoutAsync();
client.Dispose();
return;

@CXuesong
Copy link
Owner

CXuesong commented Dec 31, 2018

Perhaps you may take a look at Entity.IdsFromSiteLinksAsync. It can give you the entity IDs of the specified page titles on the specified Wiki site.

However, for now there is no implementation in WCL that can let you find the entity IDs from the specific entity title. Though it can be implemented in the future.

@CXuesong CXuesong self-assigned this May 7, 2019
@CXuesong CXuesong added this to the v0.6.x milestone May 7, 2019
@CXuesong
Copy link
Owner

CXuesong commented May 7, 2019

I know your problem has been solved in some way, but personally I'd like to implement something like searching by entity label/alias rather than sitelink.

@CXuesong CXuesong modified the milestones: v0.6.x, v0.7.x May 21, 2019
@CXuesong CXuesong modified the milestones: v0.7.x, Future Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants