FileNotFoundException on indirect import - protege

I am creating a custom ontology (Ontology A) and I get a "FileNotFoundException" regarding an indirect import when I try to import another ontology I have created (Ontology B), using the "Import an ontology contained in a specfic file." option.
Ontology B imports successfully the Micropublications ontology (can be found here) after downloading it locally in a file named micropublications.owl. While importing micropublications.owl, I use the "Import an ontology contained in a specfic file." option and everything works fine. I check the "import" section in the protege and everything seems fine, namely there is a specific "Location" pointing to the actual downloaded file etc.
When I try to import the ontology B in ontology A, it fails and the log file contains the following full stack trace
2017-09-07 11:28:20.907 [Thread-3] INFO LastResortExtractor Exception caught trying to get ontology id for file:/C:/Users/.../OntologyB.owl
org.semanticweb.owlapi.model.UnloadableImportException: Could not load imported ontology: <http://purl.org/mp/> Cause: http://purl.org/mp/
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.makeLoadImportRequest(OWLOntologyManagerImpl.java:1709) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at org.semanticweb.owlapi.owlxml.parser.OWLImportsHandler.endElement(PARSER_OWLXMLVocabulary.java:3004) ~[na:na]
at org.semanticweb.owlapi.owlxml.parser.OWLXMLParserHandler.endElement(OWLXMLParserHandler.java:422) ~[na:na]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) ~[na:1.8.0_40]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333) ~[na:1.8.0_40]
at org.semanticweb.owlapi.owlxml.parser.OWLXMLParser.parse(OWLXMLParser.java:60) ~[na:na]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:197) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1099) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:998) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at org.protege.editor.owl.model.repository.extractors.LastResortExtractor.getOntologyId(LastResortExtractor.java:21) ~[protege-editor-owl.jar:na]
at org.protege.editor.owl.model.repository.MasterOntologyIDExtractor.getOntologyId(MasterOntologyIDExtractor.java:26) [protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.checkImport(AnticipateOntologyIdPage.java:109) [protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.lambda$new$163(AnticipateOntologyIdPage.java:44) [protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage$$Lambda$120/769332687.run(Unknown Source) [protege-editor-owl.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
Caused by: org.semanticweb.owlapi.io.OWLOntologyCreationIOException: http://purl.org/mp/
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:207) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1099) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:957) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadImports(OWLOntologyManagerImpl.java:1666) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.makeLoadImportRequest(OWLOntologyManagerImpl.java:1702) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
... 25 common frames omitted
Caused by: java.io.FileNotFoundException: http://purl.org/mp/
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_40]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_40]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_40]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1889) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1884) ~[na:1.8.0_40]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1883) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1456) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) ~[na:1.8.0_40]
at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStreamFromContentEncoding(AbstractOWLParser.java:165) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStream(AbstractOWLParser.java:127) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at org.semanticweb.owlapi.io.AbstractOWLParser.getInputSource(AbstractOWLParser.java:232) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at org.semanticweb.owlapi.rdf.rdfxml.parser.RDFXMLParser.parse(RDFXMLParser.java:72) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:197) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
... 30 common frames omitted
Caused by: java.io.FileNotFoundException: http://purl.org/mp/
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835) ~[na:1.8.0_40]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) ~[na:1.8.0_40]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_40]
at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStream(AbstractOWLParser.java:103) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
... 33 common frames omitted
2017-09-07 11:28:20.907 [Thread-3] ERROR AnticipateOntologyIdPage An error occurred whilst extracting the Ontology Id from the imported ontology: {}
java.lang.NullPointerException: null
at org.protege.editor.owl.model.repository.MasterOntologyIDExtractor.getOntologyId(MasterOntologyIDExtractor.java:27) ~[protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.checkImport(AnticipateOntologyIdPage.java:109) [protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.lambda$new$163(AnticipateOntologyIdPage.java:44) [protege-editor-owl.jar:na]
at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage$$Lambda$120/769332687.run(Unknown Source) [protege-editor-owl.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
2017-09-07 11:28:25.679 [pool-2-thread-1] INFO AddImportsStrategy -------------------- Importing ontology and imports closure --------------------
It seems that Protege is searching for the Micropublications model in a file named after its base URI and not the actually file location, clearly stated in the respective import statement of Ontology B. Please note that Ontology B also imports other ontologies which cause no problem in Ontology A.
Any ideas of what is going wrong?
PS I am using Protege 5.2.0.

I have found a workaround which might be helpful to others. When I load ontology B and ontology A in the same protege window, I can import ontology B using the option "Import an ontology that is already loaded in the workspace" and everything seems to be working.
Hope this is helpful

Related

Groovy Rest-Assured missing method exception for ArrayList

I'm using IntelliJ here and I'm getting a missing method exception that I can't figure out in this Groovy implementation of RestAssured. The suspect method is this:
when().get("http://jsonplaceholder.typicode.com/posts/1")
.then().body("id", equalTo(1))
I get the following exception:
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.toSorted() is applicable for argument types: (io.restassured.internal.RequestSpecificationImpl$_applyPathParamsAndSendRequest_closure32) values: [io.restassured.internal.RequestSpecificationImpl$_applyPathParamsAndSendRequest_closure32#4d9e68d0]
Possible solutions: toSet(), toString(), toString(), toString(), toString(), sort()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1715)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1206)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1015)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:806)
at io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:55)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1731)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1206)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1015)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:806)
at io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:55)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at io.restassured.internal.RequestSpecificationImpl.get(RequestSpecificationImpl.groovy:168)
at io.restassured.internal.RequestSpecificationImpl.get(RequestSpecificationImpl.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1206)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1015)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:806)
at io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Main.main(Main.groovy:11)
I have the following imports currently:
import static io.restassured.RestAssured.*
import static io.restassured.matcher.RestAssuredMatchers.*
import static org.hamcrest.Matchers.*
I'm just aiming at a generic api out on the web for a demo. I've tried various things and it always seems to come down to the get() call itself. It also happens on the post() call I make. With the get(), if I remove everything except the get() itself, so no then() or anything after, I still get the exception.
I feel like this is some issue with the java libraries not being picked up, but heck if I understand what that might be.
I have faced same issue and found that this is because of missing Groovy dependency, add it in your pom and your problem should be solved.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>2.4.11</version>
</dependency>
https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all/2.4.11
I had a similar issue. I'v added the below dependency to fix the issue.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.11</version>
</dependency>

How to use TitanCleanup in 1.0.0?

I'm working on a school project and we've been experimenting with some bulk loading scripts. However, I need a way to clear our titan database of all vertices, edges, and properties to start over. From what I can tell, TitanCleanup.clear() is the way to do it. But whenever I go through gremlin and close the graph, calling TitanCleanup.clear(graph) just results in a groovysh_evaluate error. We can't find any better documentation of using TitanCleanup other than the titan docs which just say what it does. Any examples or pointers to where to look would be much appreciated.
Edit: This is the whole thing I'm putting into gremlin, including the stack trace
gremlin> g = TitanFactory.open('./conf/titan-hbase.properties')
==>standardtitangraph[hbase:[hadoop-16.csse.rose-hulman.edu]]
gremlin> g.close()
==>null
gremlin> TitanCleanup.clear(g)
No such property: TitanCleanup for class: groovysh_evaluate
Display stack trace? [yN] y
groovy.lang.MissingPropertyException: No such property: TitanCleanup for class: groovysh_evaluate
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:304)
at groovysh_evaluate.run(groovysh_evaluate:3)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:69)
at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:185)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:119)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:94)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:123)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:58)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:130)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:150)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:82)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:144)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:215)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:303)
You'll need to import the TitanCleanup class before you use it:
gremlin> import com.thinkaurelius.titan.core.util.TitanCleanup
After you close the graph (as you were already doing), you should be able to run TitanCleanup.clear(g) successfully.

cloudant apache-spark access design document

The following works for me when I just use the database name:
database = 'databasename'
cloudantdata_df = sqlContext.read.format("com.cloudant.spark").\
option("cloudant.host", host).\
option("cloudant.username", username).\
option("cloudant.password", password).\
load(database)
cloudantdata_df.printSchema()
However, when I try to load a particular design document and view name using the format like:
database = 'databasename/_design/analytics/_view/invBA'
I get the following java exception:
Py4JJavaError: An error occurred while calling o54.load.
: java.lang.RuntimeException: Database databasename/_design/analytics/_view/invBA request error: {"error":"method_not_allowed","reason":"Only GET,POST,HEAD allowed"}
at com.cloudant.spark.common.JsonStoreDataAccess.getQueryResult(JsonStoreDataAccess.scala:176)
at com.cloudant.spark.common.JsonStoreDataAccess.getMany(JsonStoreDataAccess.scala:85)
at com.cloudant.spark.DefaultSource.create(DefaultSource.scala:114)
at com.cloudant.spark.DefaultSource.createRelation(DefaultSource.scala:100)
at com.cloudant.spark.DefaultSource.createRelation(DefaultSource.scala:94)
at org.apache.spark.sql.execution.datasources.ResolvedDataSource$.apply(ResolvedDataSource.scala:158)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:119)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:507)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
at py4j.Gateway.invoke(Gateway.java:259)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:209)
at java.lang.Thread.run(Thread.java:785)
Is there a way to look at a particular design document view name?
In github, there is an example how to load views:https://github.com/cloudant-labs/spark-cloudant/blob/master/examples/python/CloudantDF.py#L74
You need to use view option.
In your particular case it will be:
cloudantdata_df = sqlContext.read.format("com.cloudant.spark").\
option("cloudant.host", host).\
option("cloudant.username", username).\
option("cloudant.password", password).\
option("view","_design/analytics/_view/invBA").load(database)

Load Titan graph with Gremlin

Im toataly new with TitanDB.
Im using it with cassandra & Java:
Configuration file:
storage.backend=cassandra
storage.hostname=#CASSANDRA_CLUSTER_INNER_ADDRESS#
Java code:
TitanGraph tg = TitanFactory.open(/*the configuration above*/);
if (tg.isOpen()) {
TitanManagement tm = tg.getManagementSystem();
PropertyKey key = tm.getPropertyKey(name);
/* The rest of the nice working code */
}
The Java code works fine, I can query the graph, do CRUD operations etc...
Now, I want to query the graph without using JAVA.
At first I tried using cqlsh there I saw this:
Keyspace titan
--------------
edgestore graphindex system_properties systemlog txlog
edgestore_lock_ graphindex_lock_ system_properties_lock_ titan_ids
after digging in it I understood that I need to use tool like gremlin to query the TitanDB properly.
But when I'm tring to connect the TitanDB via gremlin I get this message:
gremlin> TitanFactory.open("cassandra.local")
No such property: TitanFactory for class: groovysh_evaluate
Display stack trace? [yN] y
groovy.lang.MissingPropertyException: No such property: TitanFactory for class: groovysh_evaluate
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at groovysh_evaluate.run(groovysh_evaluate:51)
at groovysh_evaluate$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at groovysh_evaluate$run.call(Unknown Source)
at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:67)
at org.codehaus.groovy.tools.shell.Interpreter$evaluate.call(Unknown Source)
at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:152)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:114)
at org.codehaus.groovy.tools.shell.Shell$leftShift$0.call(Unknown Source)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:88)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1079)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:57)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1079)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:148)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:66)
at com.tinkerpop.gremlin.groovy.console.Console.<init>(Console.java:60)
at com.tinkerpop.gremlin.groovy.console.Console.main(Console.java:102)
My question is:
How can I get Gremlin to know TitanFactory - and finally how can I work with gremlin on my existing TitanDB v. 0.5.4?
Thanks.
If you downloaded Gremlin 2.x from the TinkerPop site, I would expect to see the error you had because it does not have the Titan libraries on the classpath.
You should get the Titan 0.5.4 download from thinkaurelius and follow along with the Gremlin Shell documentation.
http://s3.thinkaurelius.com/docs/titan/0.5.4/getting-started.html#_downloading_titan_and_running_the_gremlin_shell

How to run AST transformation?

I'm trying to run the AST transformation from this example:
http://melix.github.io/ast-workshop/exercise1-hints.html
But when I run the test I get my assertions failed.
I need to compile class AuthorAdderASTTransformation first? I even did that too, added a main method and compiled it. But still test fails saying:
groovy.lang.MissingPropertyException: No such property: $AUTHOR for class: org.gr8conf.AuthorAdderASTTransformationTest
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at org.gr8conf.AuthorAdderASTTransformationTest.testThatAuthorExists(AuthorAdderASTTransformationTest.groovy:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
groovy.lang.MissingPropertyException: No such property: $AUTHOR for class: Foo
at groovy.lang.MetaClassImpl.invokeStaticMissingProperty(MetaClassImpl.java:900)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1729)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1705)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3458)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at TestScripttestASTTransformationShouldBeDebuggableFromIDE0.run(TestScripttestASTTransformationShouldBeDebuggableFromIDE0.groovy:4)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:518)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:556)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:537)
at groovy.util.GroovyTestCase.assertScript(GroovyTestCase.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.gr8conf.AuthorAdderASTTransformationTest.testASTTransformationShouldBeDebuggableFromIDE(AuthorAdderASTTransformationTest.groovy:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
where I'm making the mistake?
The exception says that your test tried to read the property $AUTHOR, but it was not found. Assuming the transform itself is right, and that you actually ask the right class, it means it was not run. I can only assume these two points, since you didn't give any information on that.
So then onto why it was not run. AuthorAdderASTTransformation needs to be precompiled when you compile Foo. But even that is not enough, there needs to be metadata for it as well. The page http://www.groovy-lang.org/metaprogramming.html#developing-ast-xforms suggest creating a jar for it. While that is not strictly required it well prevent you forgetting the meta data file services correctly when compiling your normal source code.

Resources