RDF4J 2.4.0-M3 GeoSPARQL query not working - rdf4j

Hi I am using the latest version RDF4J 2.4.0-M3 and I am trying to execute the following query:
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX lgd: <http://data.linkedeodata.eu/ontology#>
SELECT ?s1 ?o1 WHERE {
?s1 geo:asWKT ?o1 .
FILTER(geof:sfIntersects(?o1, "POINT (-3.9468805 51.618055)"^^<http://www.opengis.net/ont/geosparql#wktLiteral>)).
}
The expected result is the following:
s1 o1
http://data.linkedeodata.eu/osm/wales/transport/Geometry/16202470 MULTIPOLYGON (((-3.9469452 51.6180887, -3.9467408 51.6183097, -3.9464539 51.6182493, -3.9457195 51.6174283, -3.9459201 51.617293, -3.9460423 51.6171659, -3.9462114 51.6174525, -3.9463139 51.6175729, -3.9466882 51.6179044, -3.9469452 51.6180887)))
The same dataset has been loaded with GraphDB v8.5 and RDF4J 2.4.0-M3, the repositories verified.
The java error I received is the following:
java error executing query of RDF4J repo
I have used the correct dependency for the BOM and rdf4j-queryalgebra-geosparql.
My dataset contains POINT, POLYGON, MULTIPOLYGON.
Any help will be appreciated.

This is a bug in the maven dependency definitions in RDF4J 2.4 milestone 3 - for some reason it grabs the wrong version of the spatial4j library. Issue has been logged at https://github.com/eclipse/rdf4j-storage/issues/108.
Workaround is to add an explicit dependency for the correct version in your project pom:
<dependency>
<groupId>org.locationtech.spatial4j</groupId>
<artifactId>spatial4j</artifactId>
<version>0.7</version>
</dependency>

Related

(ROS) Failed to create global planner

My setup is: ROS melodic, Ubuntu: 18.04
I want simulate turtlebot3 moving with my own global planner and have been following this tutorial to get started: http://wiki.ros.org/navigation/Tutorials/Writing%20A%20Global%20Path%20Planner%20As%20Plugin%20in%20ROS#Running_the_Plugin_on_the_Turtlebot. The tutorial seem to be made for ROS hydro, but as it was the best source of guidance I could find I hoped it would work.
The error I'm having is:
Failed to create the global_planner/GlobalPlanner planner, are you sure it is properly registered and that the containing library is built? Exception: MultiLibraryClassLoader: Could not create object of class type global_planner::GlobalPlanner as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()
To my knowledge I've followed the tutorial as much as possible with a only a few things done differently because I wanted to test it, couldn't do as the tutorial asked, or because I thought it wouldn't impact the results. What I have done differently is:
I use the carrot_planner.h and carrot_planner.cpp files in the tutorial section 1 to test that it works before trying with my own code to avoid confusion about where possible errors come from. It's not 'different' from the tutorial to my knowledge, but figured I'd mention it. They are placed in catkin_ws/src/carrot_planner/src/global_planner/
The ros package I'm working from is in catkin_ws/src and is called the carrot_planner. In the tutorial step 1.3 I use add_library(global_planner_lib src/global_planner/carrot_planner.cpp). Would not imagine it affects the results either.
In section 3 of the tutorial it mentions that 'First, you need to copy the package that contains your global planner (in our case global_planner) into the catkin workspace of your Turtlebot (e.g. catkin_ws).' Since my package was already in catkin_ws/src/ I haven't moved it since I guess I didn't need to.
I've altered the 'move_base.launch' file in '/opt/ros/melodic/share/turtlebot3_navigation/launch/' instead of the 'move_base.launch.xml' in '/opt/ros/hydro/share/turtlebot_navigation/launch/includes/' as there doesn't seem to be a destination '...turtlebot3_navigation/launch/includes/'. There are files in launch, but no includes folder. Maybe that a difference from Hydro to Melodic, I don't know. There may be a whole lot of things that need to be done differently from the tutorial when using Melodic, or with turtlebot3, but I don't know.
I haven't made my own launch file for bringup of the turtlebot, but have instead followed this tutorial (https://emanual.robotis.com/docs/en/platform/turtlebot3/nav_simulation/) to guide me with turtlebot3. After finishing this step in the global planner tutorial 'Save and close the move_base.launch.xml. Note that the name of the planner is global_planner/GlobalPlanner the same specified in global_planner_plugin.xml. Now, you are ready to use your new planner' I tested whether it worked by running: 'roslaunch turtlebot3_gazebo turtlebot3_world.launch' and then I tried running: 'roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml' which led to the error I showed above. I have created the map-yaml, so there's no misunderstanding whether that's missing.
I would be very glad for any help, thank you ^^
Edit: My system only had 'navfn' on it, not 'global_planner' or 'carrot_planner', if that makes a difference.
After looking over the code I found a solution. It doesn't make everything work perfectly yet, but seems to solve the immediate problem.
The problem was that in my 'global_planner_plugin.xml' I just used the code provided in the tutorial:
<library path="lib/libglobal_planner_lib">
<class name="global_planner/GlobalPlanner" type="global_planner::GlobalPlanner" base_class_type="nav_core::BaseGlobalPlanner">
<description>This is a global planner plugin by iroboapp project.</description>
</class>
</library>
But in the carrot_planner.cpp file it says:
PLUGINLIB_EXPORT_CLASS(carrot_planner::CarrotPlanner, nav_core::BaseGlobalPlanner)
Changing type="global_planner::GlobalPlanner to type="carrot_planner::CarrotPlanner and then launching turtlebot3 doesn't give the same error anymore.

attributeError:'module' object has no attribute 'MXIndexedRecordIO'

I have used im2rec.py to convert "caltech101 images" into record io format:
I have created "caltech.lst" succesfully using
os.system('python %s/tools/im2rec.py --list=1 --recursive=1 --shuffle=1 data/caltech data/101_ObjectCategories'%MXNET_HOME)
Then, when I run this :
os.system("python %s/tools/im2rec.py --train-ratio=0.8 --test-ratio=0.2 --num-thread=4 --pass-through=1 data/caltech data/101_ObjectCategories"%MXNET_HOME)
I have this error : attributeError:'module' object has no attribute 'MXIndexedRecordIO'
Please, someone has an idea to fix this error ?
Thanks in advance.
Environment info
Operating System:Windows 8.1
MXNet version:0.9.5
If I have found the right version of im2rec.py then the program is failing at one of the two calls that look like this:
record = mx.recordio.MXIndexedRecordIO(...)
That looks very much as if the code you are running is expecting a different version of mxnet from the one you have installed. The message is telling you that there isn't a class/function called MXIndexedRecordIO in module mxnet.recordio.
#user3824903 I think to create a bin directory, you have to compile MXNet from source with option USE_OPENCV=1

How can I create a JSON webservice to store and retrieve data from a simple properties file?

How can I create a Java or Javascript JSON webservice to retrieve data from a simple properties file? My intention is to uses this as a global property storage for a Jenkins instance that runs many Unit tests. The master property file also needs to be capable of being manually edited and stored in source control.
I am just wondering what method people would recommend that would be the easiest for a junior level programmer like me. I need read capability at miniumum but, and if its not too hard, write capability also. Therefore, that means it is not required to be REST.
If something like this already exists in Java or Groovy, a link to that resource would be appreciated. I am a SoapUI expert but I am unsure if a mock service could do this sort of thing.
I found something like this in Ruby but I could not get it to work as I am not a Ruby programmer at all.
There are a multitude of Java REST frameworks, but I'm most familiar with Jersey so here's a Groovy script that gives a simple read capability to a properties file.
#Grapes([
#Grab(group='org.glassfish.jersey.containers', module='jersey-container-grizzly2-http', version='2.0'),
#Grab(group='org.glassfish.jersey.core', module='jersey-server', version='2.0'),
#Grab(group='org.glassfish.jersey.media', module='jersey-media-json-jackson', version='2.0')
])
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory
import org.glassfish.jersey.jackson.JacksonFeature
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
#Path("properties")
class PropertiesResource {
#GET
#Produces("application/json")
Properties get() {
new File("test.properties").withReader { Reader reader ->
Properties p = new Properties()
p.load(reader)
return p
}
}
}
def rc = new org.glassfish.jersey.server.ResourceConfig(PropertiesResource, JacksonFeature);
GrizzlyHttpServerFactory.createHttpServer('http://localhost:8080/'.toURI(), rc).start()
System.console().readLine("Press any key to exit...")
Unfortunately, since Jersey uses the 3.1 version of the asm library, there are conflicts with Groovy's 4.0 version of asm unless you run the script using the groovy-all embeddable jar (it won't work by just calling groovy on the command-line and passing the script). I also had to supply an Apache Ivy dependency. (Hopefully the Groovy team will resolve these in the next release--the asm one in particular has caused me grief in the past.) So you can call it like this (supply the full paths to the classpath jars):
java -cp ivy-2.2.0.jar:groovy-all-2.1.6.jar groovy.lang.GroovyShell restProperties.groovy
All you have to do is create a properties file named test.properties, then copy the above script into a file named restProperties.groovy, then run via the above command line. Then you can run the following in Unix to try it out.
curl http://localhost:8080/properties
And it will return a JSON map of your properties file.

"Unexpected line" exception when using component load rules for RTC Jazz build engine

I have a component named MyComponent with the following folder structure in RTC:
/MyProject
/MyProject/TestFile.txt
/MyProject/Folder1
/MyProject/Folder1/loadrules.txt
/MyProject/Folder1/TestFile2.txt
And this is what I have in my loadrules.txt file::
versionableName=/MyProject/TestFile.txt
I've specified the loadrules.txt file in my build definition for this component as the component load rule, but when the build runs, I'm getting the following exception when it tries to fetch the files:
com.ibm.team.repository.common.TeamRepositoryException: Unexpected line "versionableName=/MyProject/TestFile.txt" encountered in build load rules for component "MyComponent"
at com.ibm.team.filesystem.client.internal.load.LoadRule.getRules(LoadRule.java:176)
at com.ibm.team.filesystem.client.internal.load.LoadRule.addLoadRules(LoadRule.java:101)
at com.ibm.team.build.internal.scm.ComponentLoadRules.getLoadRules(ComponentLoadRules.java:134)
at com.ibm.team.build.internal.engine.JazzScmPreBuildParticipant.preBuild(JazzScmPreBuildParticipant.java:235)
at com.ibm.team.build.internal.engine.BuildLoop.invokePreBuildParticipants(BuildLoop.java:844)
at com.ibm.team.build.internal.engine.BuildLoop$2.run(BuildLoop.java:650)
at java.lang.Thread.run(Thread.java:662)
Any idea what I'm doing wrong? I've tried following the example here but I can't figure why it's not working for me. Regardless of what I put in the loadrules.txt file (nothing/empty string, random garbage text, etc.), I still get this exception for the first line of the file.
This is in RTC 3.0
This kind of error is likely to be an encoding issue.
One way to test that is to create the loadrules.txt through the scm command-line interface, as detailed in "Reference > Source control command line reference > scm > create"
scm create loadrules [options]
The OP holic87 confirms:
I just used Notepad++ to recreate the text file and it's working as expected now.

Weird .net 4.0 exception when running unit tests

I am receiving the following exception when trying to run my unit tests using .net 4.0 under VS2010 with moq 3.1.
Attempt by security transparent method
'SPPD.Backend.DataAccess.Test.Specs_for_Core.When_using_base.Can_create_mapper()'
to access security critical method
'Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(System.Object)'
failed.
Assembly
'SPPD.Backend.DataAccess.Test,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' is marked with
the
AllowPartiallyTrustedCallersAttribute,
and uses the level 2 security
transparency model. Level 2
transparency causes all methods in
AllowPartiallyTrustedCallers
assemblies to become security
transparent by default, which may be
the cause of this exception.
The test I am running is really straight forward and looks something like the following:
[TestMethod]
public void Can_create_mapper()
{
this.SetupTest();
var mockMapper = new Moq.Mock<IMapper>().Object;
this._Resolver.Setup(x => x.Resolve<IMapper>()).Returns(mockMapper).Verifiable();
var testBaseDa = new TestBaseDa();
var result = testBaseDa.TestCreateMapper<IMapper>();
Assert.IsNotNull(result); //<<< THROWS EXCEPTION HERE
Assert.AreSame(mockMapper, result);
this._Resolver.Verify();
}
I have no idea what this means and I have been looking around and have found very little on the topic. The closest reference I have found is this http://dotnetzip.codeplex.com/Thread/View.aspx?ThreadId=80274 but its not very clear on what they did to fix it...
Anyone got any ideas??
In the AssemblyInfo.cs of the referenced project add this following line
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
MSDN: "The .NET Framework version 4 introduces new security rules that affect the behavior of the AllowPartiallyTrustedCallersAttribute attribute (see Security-Transparent Code, Level 2). In the .NET Framework 4, all code defaults to security-transparent, that is, partially trusted. However, you can annotate individual types and members to assign them other transparency attributes."
Haven't come across this myself, but perhaps you have imported somehing from a 3.5 project.
Check out these links:
Security Changes in the .NET Framework 4
Security-Transparent Code, Level 2
AllowPartiallyTrustedCallersAttribute Class
This has been fixed in the latest version of Moq (it was a fix in DynamicProxy actually).
Please give the latest v4 Beta a try.
http://moq.me