semiodesk/trinity-rdf

Error thrown by LINQ query

joephayes opened this issue · 1 comments

Trinity-RDF version 1.0.3.29

Given the following code:

            const int PAGE_SIZE = 4;
            const int MAX_NUMBER_OF_PAGES = 8;

            var allBands = Model.AsQueryable<Band>()
                                .OrderBy((b) => b.Name);

            // loop through pages of bands

            for (int n = 0; n < MAX_NUMBER_OF_PAGES; n++)
            {
                Console.WriteLine($"Fetching {PAGE_SIZE} bands from page {n + 1}...");

                foreach (Band b in allBands.Skip(n * PAGE_SIZE).Take(PAGE_SIZE))
                {
                    Console.WriteLine($"Band: {b.Name}");

                    foreach (SoloArtist sa in b.Members)
                    {
                        Console.WriteLine($"\tMember: {sa.Name}");
                    }
                }
            }

An exception is thrown by the line foreach (SoloArtist sa in b.Members). Exception message and stacktrace is:

VDS.RDF.Query.RdfQueryException: "A HTTP error (HTTP 400 Bad Request) occured while querying the Store.\nStore returned the following error message: {\"message\":\"com.complexible.stardog.plan.eval.ExecutionException: Encountered \\\" <NIL> \\\"( ) \\\"\\\" at line 1, column 78.\\nWas expecting one of:\\n    \\\"(\\\" ...\\n    \\\"if\\\" ...\\n    \\\"tz\\\" ...\\n    \\\"md5\\\" ...\\n    \\\"str\\\" ...\\n    \\\"abs\\\" ...\\n    \\\"day\\\" ...\\n    \\\"now\\\" ...\\n    \\\"IRI\\\" ...\\n    \\\"URI\\\" ...\\n    \\\"ceil\\\" ...\\n    \\\"year\\\" ...\\n    \\\"sha1\\\" ...\\n    \\\"uuid\\\" ...\\n    \\\"lang\\\" ...\\n    \\\"rand\\\" ...\\n    \\\"regex\\\" ...\\n    \\\"bound\\\" ...\\n    \\\"ucase\\\" ...\\n    \\\"lcase\\\" ...\\n    \\\"floor\\\" ...\\n    \\\"isIRI\\\" ...\\n    \\\"isURI\\\" ...\\n    \\\"month\\\" ...\\n    \\\"hours\\\" ...\\n    \\\"bnode\\\" ...\\n    \\\"strdt\\\" ...\\n    \\\"strlen\\\" ...\\n    \\\"substr\\\" ...\\n    \\\"concat\\\" ...\\n    \\\"sha224\\\" ...\\n    \\\"sha256\\\" ...\\n    \\\"sha384\\\" ...\\n    \\\"sha512\\\" ...\\n    \\\"exists\\\" ...\\n    \\\"minutes\\\" ...\\n    \\\"seconds\\\" ...\\n    \\\"isBlank\\\" ...\\n    \\\"strAfter\\\" ...\\n    \\\"replace\\\" ...\\n    \\\"strlang\\\" ...\\n    \\\"struuid\\\" ...\\n    \\\"strEnds\\\" ...\\n    \\\"datatype\\\" ...\\n    \\\"sameTerm\\\" ...\\n    \\\"timezone\\\" ...\\n    \\\"contains\\\" ...\\n    \\\"coalesce\\\" ...\\n    \\\"not exists\\\" ...\\n    \\\"strStarts\\\" ...\\n    \\\"strBefore\\\" ...\\n    \\\"isLiteral\\\" ...\\n    \\\"isNumeric\\\" ...\\n    \\\"langmatches\\\" ...\\n    \\\"encode_for_URI\\\" ...\\n    <Q_IRI_REF> ...\\n    <PNAME_NS> ...\\n    <PNAME_LN> ...\\n    <FUNCTION_NAME> ...\\n    \",\"code\":\"QE0PE2\"}\nSee aforementioned status line or inner exception for further details" ---> System.Net.WebException: "The remote server returned an error: (400) Bad Request."
  at at System.Net.HttpWebRequest.GetResponse()\n   at VDS.RDF.Storage.BaseStardogConnector.Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, String sparqlQuery, Boolean reasoning)
  --- End of inner exception stack trace ---
  at VDS.RDF.Storage.BaseStardogConnector.Query(IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, String sparqlQuery, Boolean reasoning)\n   at Semiodesk.Trinity.Store.Stardog.StardogStore.ExecuteQuery(ISparqlQuery query, ITransaction transaction)\n   at Semiodesk.Trinity.Model.<GetResources>d__38.MoveNext()\n   at Semiodesk.Trinity.ResourceCache.LoadCachedValues(IPropertyMapping mapping)\n   at Semiodesk.Trinity.Resource.GetValue[T](PropertyMapping`1 propertyMapping)\n   at ConsoleSample.Program.Main(String[] args) in /Users/jhayes/dev/grundfos/dotNetSample/ConsoleSample/Program.cs:95

The generated SPARQL looks like this:

SELECT ?s ?p ?o FROM <http://stardog.com/tutorial> WHERE { ?s ?p ?o . FILTER ( ) ?s = <http://stardog.com/tutorial/Mark_Herndon> || ?s = <http://stardog.com/tutorial/Jeff_Cook> || ?s = <http://stardog.com/tutorial/Randy_Owen> }

This same code worked with version 1.0.3.28

Thanks for the report. This is a bug introduced with the latest change. It is fixed in 1.0.3.30.
I've delisted the version 1.0.3.29