SWRL:not expecting an unbound argument for (0-offset) argument #1 - ontology

I'm trying to run this code on sqwrl tab in protege 5.5.0,but there is an error:
swrlb:date("2010-10-10Z"^^xsd:date, ?a, ?b, ?c, ?d) -> sqwrl:select(?a)
error:
Exception running SQWRL query S5: error running SQWRL queries: error transferring rules to Drools rule engine:
[Error: invoker.invoke("S5", "swrlb:date", 0, false, new VPATH(), new BAVNs("", "a", "b", "c", "d"), new L("2010-10-10Z", "xsd:date"), new UBA("a"), new UBA("b"), new UBA("c"), new UBA("d")): built-in exception thrown by built-in swrlb:date in rule S5: exception thrown by built-in swrlb:date in rule S5: not expecting an unbound argument for (0-offset) argument #1]
[Near : {... invoker.invoke("S5", "swrlb:da ....}]
^
[Line: 1, Column: 1]: error transferring rules to Drools rule engine:
[Error: invoker.invoke("S5", "swrlb:date", 0, false, new VPATH(), new BAVNs("", "a", "b", "c", "d"), new L("2010-10-10Z", "xsd:date"), new UBA("a"), new UBA("b"), new UBA("c"), new UBA("d")): built-in exception thrown by built-in swrlb:date in rule S5: exception thrown by built-in swrlb:date in rule S5: not expecting an unbound argument for (0-offset) argument #1]
[Near : {... invoker.invoke("S5", "swrlb:da ....}]
^
[Line: 1, Column: 1]: [Error: invoker.invoke("S5", "swrlb:date", 0, false, new VPATH(), new BAVNs("", "a", "b", "c", "d"), new L("2010-10-10Z", "xsd:date"), new UBA("a"), new UBA("b"), new UBA("c"), new UBA("d")): built-in exception thrown by built-in swrlb:date in rule S5: exception thrown by built-in swrlb:date in rule S5: not expecting an unbound argument for (0-offset) argument #1]
[Near : {... invoker.invoke("S5", "swrlb:da ....}]
^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:date in rule S5: exception thrown by built-in swrlb:date in rule S5: not expecting an unbound argument for (0-offset) argument #1: exception thrown by built-in swrlb:date in rule S5: not expecting an unbound argument for (0-offset) argument #1: not expecting an unbound argument for (0-offset) argument #1

Related

Getting 'type X is not a subtype of type Y in type cast' without call stack

I see error in console without call stack:
flutter: [ERROR]: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Map<String, Object>' in type cast
Is there a way to enable call stack for such type of errors, so that I can find the root cause?
For this exact error it helps to search for as Map<String, Object> in the code and replace the cast with .cast<String, Object>() as
the article suggests.
But, yes, it would be helpful if the call stack could be enabled.

Fortify 4.2: Translator execution failed. Status 139

When running the following command: sourceanalyzer -debug -b $build_id touchless make
I'm getting this error:
Compiling C++ myFile.C
[ERROR]: Translator execution failed. Please consult the Troubleshooting section of the User Manual.
Translator returned status 139:
“/usr/include/c++/4.3/atomicity.h”, line 51: warning identifier
“__sync_fetch_and_add” is undefined
{ return __sync_fetch_and_add(__mem, __val); }
“/usr/include/c++/4.3/atomicity.h”, line 55: warning identifier
“__sync_fetch_and_add” is undefined
{ __sync_fetch_and_add(__mem, __val); }
“/usr/include/c++/4.3/new”, line 95: warning: first parameter of allocation
Function must be of type “size_t”
Void* operator new(std::size_t) throw (std::bad_alloc);
“/usr/include/c++/4.3/new”, line 96: warning: first parameter of allocation
Function must be of type “size_t”
Void* operator new[](std::size_t) throw (std::bad_alloc);
“/usr/include/c++/4.3/new”, line 99: warning: first parameter of allocation
Function must be of type “size_t”
Void* operator new(std::size_t, const std::nothrow_t&) throw ();
“/usr/include/c++/4.3/new”, line 100: warning: first parameter of allocation
Function must be of type “size_t”
Void* operator new[](std::size_t, const std::nothrow_t&) throw ();
“/usr/include/c++/4.3/new”, line 105: warning: first parameter of allocation
Function must be of type “size_t”
Inline void* operator new(std::size_t, void* __p) throw (){ return __p; }
“/usr/include/c++/4.3/new”, line 105: warning: first parameter of allocation
Function must be of type “size_t”
Inline void* operator new[](std::size_t, void* __p) throw (){ return __p; }
“/opt/ilog51/views51/include/ilog/list.h”, line 77: warning: first parameter of allocation function must be of type “size_t”
IL_MLK_DECL();
“/opt/ilog51/views51/include/ilog/list.h”, line 110: warning: no appropriate operator delete is visible
{ e(); delete_first; _first; _first = _last 0; _length = 0; }
Furthermore, when uploading the FPR file to SSC, under Artifacts the status is: Error Processing. And when auditing issues, the ssc is unable to locate source files.
Any ideas about this issues ?
One idea is that the older gcc 4.3 (year 2008?) used compiler built-ins that were specific to GCC, while Fortify relies on Clang to translate the source code.
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html

Elegant way to handle missing argument using ArgResults

Suppose:
var p = new ArgParser();
p.addOption('query');
Is there a way using ArgResults to determine whether user failed to supply --query argument without catching the ArgumentException?
$ dart myprogram.dart --query
Unhandled exception:
FormatException: Missing argument for "query".
I tried:
results['query'] != null
but get the same exception.
No. The ArgParser always throws a FormatException on parse when the user does not provide the expected arguments.

unable to insert document in mongo using gmongo

I have the following code to insert a document in groovy but I keep getting this error in grails applications
def zipcode = getDocumentCollection()
zipcode.insert(["city": "ACMAR", "loc": [-86.51557F, 33.584132F], "pop": 6055, "state": "AL", "_id": "35004"])
No signature of method: com.mongodb.DBApiLayer$MyCollection.insert()
is applicable for argument types: (java.util.LinkedHashMap) values:
[[city:ACMAR, loc:[-86.51557, 33.584133], ...]] Possible solutions:
insert([Lcom.mongodb.DBObject;), insert(java.util.List),
insert([Lcom.mongodb.DBObject;, com.mongodb.WriteConcern),
insert(com.mongodb.DBObject, com.mongodb.WriteConcern),
insert(com.mongodb.WriteConcern, [Lcom.mongodb.DBObject;),
insert(java.util.List, com.mongodb.WriteConcern)
this code is taken from the example of gmongo. Any ideas why I'm getting an error ?
UPDATE
I get the below error in Grails app after trying #dmahapatro's approach:
2013-06-06 09:54:21,493 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'org.springframework.data.mongodb.monitor.OperationCounters#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mongodb.Mongo]: Could not convert constructor argument value of type [com.gmongo.GMongo] to required type [com.mongodb.Mongo]: Failed to convert value of type 'com.gmongo.GMongo' to required type 'com.mongodb.Mongo'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.gmongo.GMongo] to required type [com.mongodb.Mongo]: no matching editors or conversion strategy found
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.data.mongodb.monitor.OperationCounters#0': Unsatisfied dependency expressed
through constructor argument with index 0 of type [com.mongodb.Mongo]: Could not convert constructor argument value of type [com.gmongo.GMongo] to required type [com.mongodb.Mongo]: Failed to
convert value of type 'com.gmongo.GMongo' to required type 'com.mongodb.Mongo'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.gmongo.GMongo] to required type [com.mongodb.Mongo]: no matching editors or conversion strategy found
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
When you use insert you need to provide the key-value pairs as named args (I think you can also use a map but it will be less verbose).
zipcode.insert(city: "ACMAR", loc: [-86.51557F, 33.584132F], pop: 6055, state: "AL", _id: "35004")
If you want to use a HashMap then use the left-shift operator to insert documents into collection.
zipcode << ["city": "ACMAR", "loc": [-86.51557F, 33.584132F], "pop": 6055, "state": "AL", "_id": "35004"]
I would go with the second approach if I were using aggregation.
Sample
This works perfect for me when tested.
#Grab(group='com.gmongo', module='gmongo', version='1.0')
import com.gmongo.GMongo
def mongo = new GMongo("127.0.0.1", 27017)
def db = mongo.getDB("gmongo")
//Instead of doing below I can also use db.zipcodes.insert(blah: blah)
def zipCode = db.getCollection("zipcodes")
zipCode.insert(city: "ACMAR", loc: [-86.51557F, 33.584132F], pop: 6055, state: "AL", _id: "35004")
zipCode << [city: "DUMMY", loc: [-86.51587F, 33.584172F], pop: 6056, state: "AL", _id: "35005"]
assert db.zipcodes.findOne(city: "DUMMY").city == 'DUMMY'
assert db.zipcodes.findOne(city: "ACMAR").city == 'ACMAR'

F# exception and inner exception property

in F# i can declare a custom exception like so:
exception Foo of string,
which will map the string to the Message property.
how do I declare one that I can later use to raise a caught exception as the inner exception of this one? In other words, how do i do something like (pseudo)
try
...
with e -> raise Foo (message, innerException) where innerException is e?
Thanks!
The simple declaration of exceptions using exception is limited in many ways. If you want to use other features of standard .NET exceptions (i.e. inner exception), then you can declare exception as a class:
open System
type FooException(message:string, innerException:Exception) =
inherit Exception(message, innerException)
You can also provide overloaded constructors, for example if you want to use null as a default value for InnerException.
The exception can be raised as an ordinary .NET exception using raise:
raise (new FooException(message, e))

Resources