Apache Jena RIOT Exception when loading external RDF or Turtle File - apache-jena

I am trying to load an external vocabulary (http://purl.org/eis/vocab/daq#) - this vocabulary has valid syntax and can be dereferenced and has both an RDF/XML and TURTLE serialisation - using the RDFDataMgr, however, I am getting a RIOTException:
org.apache.jena.riot.RiotException: [line: 23, col: 1 ] Broken token (newline): The Dataset Quality Vocabulary (daQ) is a lightweight, extensible core vocabulary for attaching the result of quality benchmarking of a linked open
This exception is only happening when I try to load it externally. Loading works when I use my local copy of the vocabulary. I was using the 2.11.1 version of Jena, but yesterday I updated the code to the latest 3.3.0, but I still had the same exception. I am thinking that this might be a problem related to how the Jena mechanics and external libraries are reading non-local sources. Does anyone have an idea how this can be fixed?
Thanks
Jeremy

The endpoint returns Turtle that is broken and not valid syntax.
There are raw newlines in the string around line 23. Replace with """-quoting or fix the data.
The RDF/XML is OK.
Use RDFParser to build a parser process that sets the "accept" header to "application/rdf+xml". The default used by RDFDataMgr prefers Turtle.

Related

Can't use lldbbridge.py to inspect Qt objects because error in "wrapper prefix"

A little configuration information to start:
Xcode 13
Qt 5.15.5
iOS 14.7.1 (18G82) (I'm running on a device, not a
simulator)
Host MacOS Big Sur 11.6
I'm debugging a large Qt app, all written in C++, except for the necessary few files to make it work in iOS (so it's really an Objective-C++ app with an enormous amount of native C++ linked to it, everything of Qt it needs). I have a break point within the LoadApplication method - Qt has been built from source for development (that is, in debug configuration with symbols). There are a number of native Qt QUrl objects whose values I'd like to inspect. I have successfully installed lldbbridge.py, but I think the problem may be unrelated to that, because I saw it when I was using other tricks to see the data without the bridge. There is a method called toString on the QUrl class that produces a text representation of the URL (and another called toDisplayString that may be more human readable). These methods produce (of course) QString objects. So here are the failure modes:
First the bridge should be helping me to inspect the QUrl and all I see are the raw object descriptions that hide all the private interfaces. It isn't.
before I installed the lldbbridge.py script, I was able to view some of these objects (local variables, but not parameters), using code like expr url.toString().toStdString().c_str(). It still might work on local variables, but I would really like to be able to inspect parameters as well.
the error feedback I get is
error: <lldb wrapper prefix>:21198:9: module 'std' not found
#import std;
~~~~~~~^~~
this is a pretty legit error, because I have scoured my system and the internet for evidence of this std.framework whose existence is implied, and cannot find it, though its name suggests that it would be an assist to Objective-C or Swift to deal with std::string and the like. Possibly it was a thing in Xcode 12 that has been dropped in Xcode 13, but if so, it has no footprint on the web that I can find. Still, presumably Qt 5.15.5's lldbbridge.py was compiled and run and against it at some point in the recent past.
this isn't the only trick that doesn't work when inspecting a QString, with or without the bridge. I also tried expr (const wchar_t*)url.toString().toUtf16() and expr (const char*)url.toString().toUtf8() and so forth. The same error feedback results, complaining about the mysterious "std" framework or module.
and don't get too hung up on QUrl objects, because I get the same result with other QStrings.
one more symptom: if I do an expr #import std; in the lldb command line, it appears to work. That is, it gives no error feedback and appears to complete. This just makes the world weirder, because if exists, it must be hiding somewhere inside Xcode's contents, but I've done file searches in there, and see no evidence of such a thing. And if it does exist, why is the lldb wrapper prefix giving me grief? Could the wrapper be underspecified in terms of framework search paths, but the lldb command line not?
So as if it's not too obvious, here are my questions (besides WTF???):
Am I the first to see this? I've seen some forum talk about string inspection no longer working for others in Xcode 13 lldb, but the specific failure mode is different. Anyone else see this?
Does anyone have any idea about this mysterious "std" framework or module? Could its functionality have been sucked up into some other module or framework for Xcode 13?
Any ideas about work-arounds that I haven't thought of? I'm not a complete lldb novice, but I'm not an expert either.
I'd like to turn up the log levels look at those for clues, but I've never used that feature before, and I don't really even know where to FIND the logs.
I notice that the feedback suggests that there are at least 21198 lines in this "wrapper" BEFORE we get to the failing import statement. Seems a little excessive to wrap a request to view the contents of a string. Perhaps the whole wrapper is corrupted in some way. Any thoughts on how to test that hypothesis? How about a way to inspect the contents of the wrapper prefix itself?
Could the #import std; be a red herring and just co-lateral damage in some other unrelated failure mode? It's tempting to imagine it's some kind of std library support thing, but I don't want to assume too much at this point.
one more things about "std", whatever it is - lldb is super dynamic. It's always compiling inline code on-the-fly to support its functionality. That's the whole llvm magic. Is it possible it exists only as some inline text within lldb's source? And again, if so, why is it only selectively available?
Well, that's my nightmare. Unless my setup is horribly corrupted in some way and it's my unique curse, I'm sure this problem will show up for others, so cogent answers will make you a hero. Any pointers are appreciated. Thanks.

What are the drawbacks of using autospec in python unittest module

I don't see any major drawbacks for not using autospecs.
I have gone through the documentation, but I am still not clear: https://docs.python.org/3.3/library/unittest.mock.html#auto-speccing
Can someone please explain what this line means with an example.
If any of your specced objects have properties or descriptors that can trigger code execution then you may not be able to use autospec.

loading binary STL model with assimp

I've started to get familiar with Assimp. My tasks with this library is quite simple, just to load a 3D model, visualize it and sparse neccessary information from it e.g. facets, facet normals... probably some manipulatinos with camera
I've successfully loaded several models at link
the example given here can load obj and ascii stl models. However, the same task cannot be done with STL binary model which generates an error like: "ASCII file is empty or invalid; no data loaded - could not load model"
two other references confirm me that my error is not the first one:
link1
link2
the 2nd link recommends to use ivcon as a solution. however the post was quite 3 years ago
How about the current solution? can I fix it directly with some import command settings?
my bad! I was so closed to the answer which is already there in link2 but I didn't even try it.
So, just now, I simply changed the STL file's header "solid" to any other group of characters such as "abcde" and the import works normally

SAXParseException that only occurs locally. Works on WebServers

I am writing a junit test that is testing and older piece of code. This code works on our iplanet webservers and our local Tomcat servers and runs with no problems. However when run by the JUNIT test I get this exception.
Background: It pulls an XSL file from a JAR then transforms it with an xml document that is read in from a resource file.
I have tried changing transformer factories, changing encoding, and checked all files for null characters using a hex editor. Any ideas?
[Fatal Error] :2251:46: An invalid XML character (Unicode: 0x0) was found in the value of attribute "test" and element is "xsl:when".
SystemId Unknown; Line #2251; Column #46; org.xml.sax.SAXParseException; lineNumber: 2251; columnNumber: 46; An invalid XML character (Unicode: 0x0) was found in the value of attribute "test" and element is "xsl:when".
**UPDATE
I have found that if I use the project's class folder where the XSL is held and move it about the jar's dependency it works, but if it uses the xsl out of the jar it breaks
SUGGESTIONS:
1) Make sure your library versions all match.
2) I suspect that " An invalid XML character (Unicode: 0x0) was found" might be caused by any of several completely different things. You should investigate each of them.
3) First, most obvious - check your input for a null character :)
4) Second, check your encoding - perhaps your sender is writing UTF-16, but your reader is expecting UTF-8. Here's a good link:
*
Error about invalid XML characters on Java
This is an encoding issue. Either you read it the inputstream as UTF8
and it isn't or the other way around.
You should specify the encoding explicitly when you read the content.
E.g. via
new InputStreamReader(getInputStream(), "UTF-8")
Another problem could be the tomcat. Try to add URIEncoding="UTF-8" in
your tomcat’s connector settings in the server.xml file
5) The root cause might also be a failed read or a missing object of some kind. A missing definition, perhaps.
Q: What is "SystemId"? What might cause it to "go missing"?
6) One possibility is that "resolveEntity()" is failing:
InputSource resolveEntity(String publicId, String systemId)
Here are a couple of links regarding that problem:
Java SAX Parser raises UnknownHostException
how to disable dtd at runtime in java's xpath?
7) Both of these links suggest "resolveEntity() might be failing because you can't connect to a specified host. Check the network host names listed in your XML, and make sure you can "ping" them.
If it's got as far as line 2251 that suggests strongly that there's something wrong with the file contents around that location. If there's nothing wrong with the file at that location, my next suggestion would be that something's wrong with the parser. I know it sounds crazy, but the XML parser built in to the JDK is seriously buggy, and I would check whether the problem goes away if you install the Apache version of Xerces in its place. In many cases this is simply a question of putting the relevant JAR files in the lib/endorsed directory of the JDK installation.
This was caused because the XSL files I was trying to transform were still in a JAR. I had to have Maven extract the files into the target directory first.

Building Boost on OpenVMs

I’m hoping to port an application to open vms using HP C++7.3, but at the minute just trying out a few examples to establish if it's a potential way forward but a bit stuck. Being completely new to open vms it's being a lot of fun so far.
For starters I've not got very far building boost as a whole, after some googling I found a few mentions of people having dcl scripts to build boost but no actual scripts. I don’t suppose anyone has any or can pint me to some. I ‘only’ need asio and threading.
Currently I’m just trying to compile the asio chat examples. And as I said I’m completely new to VMS and the compiler, I managed to get a few things to compile but now get a “could not open source file "sys/select.h"’, a bit of googling suggests I may need to have an HP porting library installed or maybe I’m just missing an prepocessor directive to include the correct code, can’t see anything obvious in socket_types.hpp to set?
Any pointers in the right general direction would be gratefully appreciated.
No answers since the questio is too open ended and in a realm I know little about.
Just some thoughts.
Select can be provided by the OpenVMS TCPIP services (aka UCX), or other TCP stack.
At the dcl prompt try: $ HELP TCPIP_Services Programming_Interfaces Socket_API
Async programming on OpenVMS is typically 'event driven'.
Google for SYS$QIO and AST
There is a public access OpenVMS system which holds 'NOTES FILES' (pre-cursor to web-forums)
Try TELNET to EISNER.DECUS.ORG and you'll get sign up instructions.
Once you are in find your way to the PORTING_TO_VMS conference
Once in the NOTES conference you can issue the command DIRECTORY or DIR/TIT=xxx
Unfortunately there is not topic for select, but you can find some interesting
reading using NOTES> SEARCH "select(" followed by repeated SEARCH commands)
( $ NOTES ... OPEN PORT ... SEARCH "select(" ... SEARCH [] ... SEARCH ... )
The PERL folks did an admirable job getting open stuff to work on OpenVMS.
Good luck!
boost library on OpenVMS can be used directly from headers.
I remember one thing to make sure was that BOOST logical is defined concealed, so the relative-includes work.