Strange CONSTRUCT behavior with FROM clause

On my Stardog Cloud instance, in Stardog Studio, I get results running this CONSTRUCT statement:

prefix : <urn:myexample:> 
CONSTRUCT {?s ?p ?o} FROM :graphX  WHERE {?s ?p ?o} } ORDER BY ?s ?p ?o

Notice the TWO closing curly brackets before the ORDER BY (which is a syntax error).

But, I get an error running the correctly formatted query:

prefix : <urn:myexample:> 
CONSTRUCT {?s ?p ?o} FROM :graphX  WHERE {?s ?p ?o} ORDER BY ?s ?p ?o

I get the error:

000012: com.complexible.stardog.plan.eval.operator.OperatorException: Uncaught error during query evaluation: NullPointerException: 

This is new behavior since the maintenance update.

BTW, via pystardog, neither query executes. The double curly brackets indeed generate a syntax error, but the correct syntax returns the NullPointer exception.

Andrea

Any update on this?

This seems a rather serious SPARQL violation.

Hi Andrea,

Sorry for the delayed response. This must be 2 separate issues. Stardog correctly fails to parse the 1st query (that's why you get the syntax error from pystardog) but somehow Studio doesn't show it. I'll check with the UI team.

As for the 2nd issue, I confirm that this is a server-side failure, most likely data-specific (esp. if it goes away if you drop the ORDER BY). Any chance we can look at your data while investigating it?

Best,
Pavel

Pavel, When I remove the ORDER BY, I get results in Studio with a correctly formatted query.

BUT, the data has edge properties!

This is not handled by pystardog when I remove the ORDER BY. I get the error
"< :Sentence_de4817bb-5794 :rhetorical_device "logos" does not look like a valid URI, trying to serialize this will break. (term.py:287)"

This somehow (likley) plays into the NullPointer when using ORDER BY.

HTH,
Andrea

OK, yes, this is certainly possible. Thanks, we will look into it.

Best,
Pavel

PS. there's the isStatement function that you can use in a FILTER or BIND. Perhaps it might help as a workaround in a short term.

We have been able to reproduce both issues (the NPE and Studio ignoring invalid the }). We'll try to fix the former before the next release.

For now the workaround should be to avoid ORDER BY on a variable which could have embedded statements as values. It's indeed a problem with edge properties.

Thanks,
Pavel

Is it possible to also fix pystardog since there is still an error there, even without the ORDER BY?

Andrea

My understanding is that pystardog just doesn't support edge properties at the moment. I will create a ticket for that, but its release cycle is different from the platform and I cannot tell when that feature will be released.

Best,
Pavel

Here's the ticket: add basic support for edge properties · Issue #168 · stardog-union/pystardog · GitHub
pystardog is open source and so is the issue tracker.

Best,
Pavel