Jena ARQ query execution extension - jena

We are trying to extend jena ARQ by adding a new operator. However, for now, we don't want to do this from the very beginning i.e., going through all steps from the query parse to query execution. We are thinking to rewrite the execution plan manually then let ARQ execute the rewritten plan. I did some search on the web, however, I couldn't find any information about edit execution plan manually. I was wondering if there is a way to write the plan to a file and edit the file manually then let ARQ read the file from disk and execute it. Is this even possible? Can anyone give me a hint on how to start this problem?

A starting point is to look at reading and writing the algebra with SSE.parseOp and execute with QueryExecUtils.
OpExecutor is the mechanism for executing SPARQL algebra and if you add a new Op type, that's where to add the execution.

Related

Machine parseable error messages

(From https://groups.google.com/d/msg/bazel-discuss/cIBIP-Oyzzw/caesbhdEAAAJ)
What is the recommended way for rules to export information about failures such that downstream tools can include them in UIs.
Example use case:
I ran bazel test //my:target, and one of the actions for //my:target fails because there is an unknown variable "usrname" in my/target.foo at line 7 column 10. It would also like to report that "username" is a valid variable and this is a possible misspelling. And thus wants to suggest an addition of an "e" character.
One way I have thought to do this is to have a separate file that my action produces //my:target.errors that is in a separate output group and have it write machine parseable data there in addition to human readable data on stdout.
I can then find all of these files and parse the data in them in downstream tools.
Is there any prior work on this, or does everything just try to parse the human readable output?
I recommend running the error checkers as extra actions.
I don't think Bazel currently has hooks for custom error handlers like you describe. Please consider opening a feature request: https://github.com/bazelbuild/bazel/issues/new

How to create and load a configuration file in dxl

I have a script which saves some files at a given location. It works fine but when I send this code to someone else, he has to change the paths in the code. It's not comfortable for someone who does not know what is in that code and for me to explain every time where and how the code should be changed.
I want to get this path in a variable which will be taken from the configuration file. So it will be easier for everyone to change just this config file and nothing in my code. But I have never done this before and could not find any information on how I can do this in the internet.
PS: I do not have any code and I ask about an ultimate solution but it is really difficult to find something good in the internet about dxl, especially since I'm new with that. Maybe someone of you already does that or has an idea how it could be done?
DXL has a perm to read the complete context of a file into a variable: string readFile (string) (or Buffer readFile (string))
you can split the output by \n and then use regular expressions to find all lines that match the pattern
^\s*([^;#].*)\s*=\s*(.*)\s*$
(i.e. key = value - where comment lines start with ; or #)
But in DOORS I prefer using DOORS modules as configuration modules. Object Heading can be the key, Object Text can be the value.
Hardcode the full name of the configuration module into your DXL file and the user can modify the behaviour of the application.
The advantage over a file is that you need not make assumptions on where the config file is to be stored on the file system.
It really depends on your situation. You are going to need to be a little more specific about what you mean by "they need to change the paths in the code". What are these paths to? Are they DOORS module paths, are they paths to local/network files, or are the something else entirely?
Like user3329561 said, you COULD use a DOORS module as a configuration file. I wouldn't recommend it though, simply because that is not what DOORS modules were designed for. DOORS is fully capable of reading system files in one line at a time as well as all at once, but I can't recommend that option either until I know what types of paths you want to load and why.
I suspect that there is a better solution for your problem that will present itself once more information is provided.
I had the same problem, I needed to specify the path of my configuration file used in my dxl script.
I solved this issue passing the directory path as a parameter to DOORS.exe as follow:
"...\DOORS\9.3\bin\doors.exe" -dxl "string myVar = \"Hello Word\"
then in my dxl script, the variable myVar is a global variable.

Processing multiline events from a text file in Dataflow

I am attempting to build a dataflow pipeline to process a text file which contains events that span multiple lines. The dataflow SDK TextIO class assumes each line is a new event.
My plan is to create a new TextReader and register it with the DataPipelineRunner. This new reader will know how to aggregate the multiple lines into a single line.
I am pretty sure that this approach will work but I am wondering if this is the right way to do it or if there is a simpler solution?
The text I am trying to parse is:
==============> len:45 pktype:4 mtype:2
SYMBOL: USOCSTIA151632.00
OPEN_INT: 212
PR_OPEN_INTEREST: 212
TIME_STAMP: 04/10/2015 06:30:17:420 val:1428661817
The result should be the last 4 lines concatenated together and the first line dropped.
Best regards,
Peter
Note that TextReader is an internal implementation detail class, so subclassing it would be highly discouraged and challenging to do properly.
The recommended way to define a new file-based format like yours is to subclass FileBasedSource using the user-defined source API.
In your case, I would recommend to base your class on the LineIO example from documentation, and wrap the LineReader defined there into your own class which would use LineReader as a helper for reading individual lines, but:
In startReading() it would skip until the line starting with "====>"
In readNextRecord() it would read lines until the next "====>" and bundle them into a single record.
Please make sure to carefully read the documentation to FileBasedSource and FileBasedReader: the parallelization mechanism relies on the consistency properties described there, which your format has to satisfy, for ensuring that records are not duplicated or omitted on the boundaries between adjacent processing shards. XmlSource tests are a good example of how to unit-test these properties.
Please tell us how it goes and report back with any problems or questions - we are very interested in feedback on this API.

How to set explain option?

If you issue this command to informix server, the server will just generate explain and won't run the query. Great feature if your query doesn't end at all.
SET EXPLAIN ON AVOID_EXECUTION;
If you issue this command to informix then the Explain file will be generated at that location .
SET EXPLAIN FILE TO 'c:\temp\sql.out';
But, I need both options on and I can't figure out the syntax for doing that. If I execute both statements then the latter overrides the former.
Execute first the SET EXPLAIN FILE TO 'c:\temp\sql.out';, this way you set the target.
Then you change to avoid execution : SET EXPLAIN ON AVOID_EXECUTE;;

Where can i find an msi conditions parser

I am looking for a library or utility that can parse the msi launch conditions. Basically i want to take these statements and translate them into our own langauge, but before i do that i need to parse it up.
I can already pull a list conditions out of an MSI, for example:
NOT VersionNT OR (VersionNT = 501 AND ServicePackLevel >= 2) OR (VersionNT > 501)
But i was hoping there was already something that can break this up into a more interpretable format.
Additional question, what is this language called? I can figure out how to refer to it or search for it.
Cheers
See:
Conditional Statement Syntax
Windows Installer exposes a Win32 function and an Automation Method for evaluating conditions.
MsiEvaluateCondition Function
Session.EvaluateCondition Method
Try the Wine source code. They have the following grammar file for conditions:
http://source.winehq.org/source/dlls/msi/cond.y

Resources