Message Boards Message Boards


Wolfram Alpha for .NET: open source software library

Posted 9 months ago
1 Reply
6 Total Likes

Wolfram Alpha

Wolfram Alpha .NET

Hello everyone!

I would like to announce Wolfram Alpha .NET

Repository link:

Wolfram Alpha .NET is an open source software library for interacting with the Wolfram Alpha API on the .NET platform.

After doing some research, I found out that there's no library for Wolfram Alpha for .NET being mantained and up-to-date. The .NET library published on the Wolfram site has not been updated for ages, and it is written in Visual Basic. So with the help of Wolfram Alpha Full Results API documentation and Wolfram Alpha Webservice API documentation I built a type-safe library to query Wolfram Alpha from .NET.

Quick Start

Create a WolframAlphaService with your APP ID:

WolframAlphaService service = new WolframAlphaService("YOUR APP ID");

Create a request to query with WolframAlphaRequest:

WolframAlphaRequest request = new WolframAlphaRequest
    Input = "YOUR QUERY"

Send the request to WolframAlpha:

WolframAlphaResult result = await service.Compute(request);

WolframAlphaResult is a class that holds the QueryResult QueryResult structure

Some values may or may not be defined in the result, since it depends on the query and the response given by the Wolfram Alpha Webservice API. For instance, there may be cases in which Wolfram Alpha returns or not Assumptions, Tips, Errors, etc. However, all the properties are defined in the code, and you'll be able to see them when coding (code prediction with Intellisense on VIsual Studio)

And if you'd like to print on the console the Pods with text returned, you could do it this way:

foreach (var pod in result.QueryResult.Pods)
    if(pod.SubPods != null)
        foreach (var subpod in pod.SubPods)
            Console.WriteLine("    " + subpod.Plaintext);

Which will print the following in the case of querying "Stephen Wolfram":

Console Example

You can filter and do more complex queries by including other properties on the WolframAlphaRequest object such as the Pod Ids , Units (Metric, non metric), formats, your location, etc. Look at parameter references.

Some work is still left to be done, however I believe in it's current state is usable for most situations.

All suggestions are Welcome. Hope you enjoy it!

Found an issue

Please report it through Github issues on the repository

Would you like to contribute?

Contributions are always welcome! Fork the repo and submit a Pull Request

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract