I've got a AllegroGraph server running and have trouble querying remote datastore, there's very little information on documentation.
Here's my lil piece of code:
using System;
using VDS.RDF;
using VDS.RDF.Storage;
namespace PoC {
class Program {
static void Main(string[] args) {
string server = "http://server";
string repo = "repo";
string username = "username";
string password = "password";
AllegroGraphConnector agraph = new AllegroGraphConnector(server, repo, username, password);
Options.HttpDebugging = true;
Options.HttpFullDebugging = true;
agraph.Query("SELECT * WHERE { emid:_PCAT_0001 ?p ?o }");
Console.ReadLine();
}
}
}
MALFORMED QUERY: Parse error: namespace mapping for "emid" not defined when expanding QName "emid:_PCAT_0001".
Although in AllegroGraph WebView I can run exactly the same query and namespace is loaded into repository.
How do I resolve that?
You will need to declare the prefix emid: in your query. Presumably the AllegroGraph WebView UI is doing that automatically for you, but the plain SPARQL endpoint won't.
Try using something like this:
agraph.Query("PREFIX emid: <http://your.uri.goes/here> SELECT * WHERE { emid:_PCAT_0001 ?p ?o }");
Obviously you should replace that fake URI with the real URI that your emid: prefix maps to!