0

I'm using OrientDB with gremlin server (https://s3.us-east-2.amazonaws.com/orientdb3/releases/3.1.1/orientdb-tp3-3.1.1.zip) and my requirement is to load a RDF file to orientDB. I'm using rdflib python library to act as a middleware to parse and load the file but it fails. Please see the error logs below:

Invalid OpProcessor requested [null]
org.apache.tinkerpop.gremlin.server.op.OpProcessorException: Invalid OpProcessor requested [null]
    at org.apache.tinkerpop.gremlin.server.handler.OpSelectorHandler.decode(OpSelectorHandler.java:85)
    at org.apache.tinkerpop.gremlin.server.handler.OpSelectorHandler.decode(OpSelectorHandler.java:48)

Also, when the server starts i get a few warnings about some classes not able to load. i suspect they might be responsible for the failure.

020-07-25 15:47:35:541 WARNI The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated. [AbstractChannelizer]
2020-07-25 15:47:35:604 WARNI The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated. [AbstractChannelizer]
2020-07-25 15:47:35:626 INFO  Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 [AbstractChannelizer]
2020-07-25 15:47:35:626 WARNI The org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0 serialization class is deprecated. [AbstractChannelizer]
2020-07-25 15:47:35:629 INFO  Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0 [AbstractChannelizer]
2020-07-25 15:47:35:629 INFO  application/json already has org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 configured - it will not be replaced by org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, change order of serialization configuration if this is not desired. [AbstractChannelizer]

The python code using RDFlib is as follows

import os
from rdf2g import setup_graph, load_rdf2g
from rdflib import Graph
from pathlib import Path
import pprint


# connect to the graph server configured to OrientDB
DEFAULT_LOCAL_CONNECTION_STRING = "ws:localhost:8182/gremlin"
g = setup_graph(DEFAULT_LOCAL_CONNECTION_STRING)
# get the working directory
current_dir = os.getcwd()
# temp holder for rdf filename
rdf_file = 'C:\\Users\\nnn\\Desktop\\rdf_config\\Education_simple.rdf'
# define the path to the rdf
rdf_path = os.path.join(current_dir, r'rdf_config', rdf_file)
# read the rdf file to a graph
rdf_graph = Graph()
rdf_graph.parse(rdf_file)


# load the RDF graph into a property graph
load_rdf2g(g, rdf_graph)

and below are the logs after running this python script:

File "c:/Users/nnn/Desktop/rdf2gremlin0721.py", line 36, in <module>
    load_rdf2g(g, rdf_graph)
  File "C:\Program Files\Python37\lib\site-packages\rdf2g\update.py", line 33, in load_rdf2g
    link_nodes(g, subj_node, obj_node, p, rdf_graph)
  File "C:\Program Files\Python37\lib\site-packages\rdf2g\update.py", line 122, in link_nodes
    print(g.V(Bindings.of('id', source_node)).addE(property_label).to(target_node).iterate())
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\process\traversal.py", line 66, in iterate
    try: self.nextTraverser()
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\process\traversal.py", line 71, in nextTraverser
    self.traversal_strategies.apply_strategies(self)
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\process\traversal.py", line 573, in apply_strategies
    traversal_strategy.apply(traversal)
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\driver\remote_connection.py", line 149, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\driver\driver_remote_connection.py", line 56, in submit
    results = result_set.all().result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 435, in result
    return self.__get_result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\driver\resultset.py", line 90, in cb
    f.result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 428, in result
    return self.__get_result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "C:\Program Files\Python37\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\driver\connection.py", line 83, in _receive
    status_code = self._protocol.data_received(data, self._results)
  File "C:\Program Files\Python37\lib\site-packages\gremlin_python\driver\protocol.py", line 111, in data_received
    del results_dict[request_id]
KeyError: None

Please let me know if you know any details about it.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
im_nawaj
  • 1
  • 1
  • There is no issue mentioned relating to RDFlib in this question, even though you say you are using it. Please un-tag as RDFlib. – Nicholas Car Jul 30 '20 at 16:02
  • Thank you for your response. Actually RDFlib is being used. apologies i forgot to add details about it. I've updated the question with more details. – im_nawaj Jul 31 '20 at 10:56
  • Even with your additional information, this question raises no issues with RDFlib: the error indicated is in the Gremlin function and you’ve not asked about RDFlib or how it functions. Seems RDFlib is converting your RDF file to a graph fine so the problem isn’t related to that. – Nicholas Car Aug 01 '20 at 16:47

0 Answers0