VitalyT
VitalyT

Reputation: 1691

Titan DB 1.0.0 : Cannot import Json file into titan TinkerPop 3.x

How make import from JSON file into titan DB , when i use geolocation property ??

I'm working with Titan DB TP3 - version 3.0.1-incubating

gremlin> Gremlin.version()
==>3.0.1-incubating
gremlin>

and using GeoShape index property (geolocation) , trying to export and import into new DB.

My steps are as following:

   //export : 
        tg = TitanFactory.open(‘../conf/titan-db.properties’)
        tg.io(IoCore.graphson()).writeGraph('/var/backups/PRODUCTION_DATA_27_10_16.json');



  //import to new DB:
       tg.io(IoCore.graphson()).readGraph('/var/backups/PRODUCTION_DATA_27_10_16.json'); 

but unfortunately got exception :

gremlin> tg.io(IoCore.graphson()).readGraph('/var/backups/PRODUCTION_DATA_27_10_16.json');
Property value [{type=Point, coordinates=[33.0, 32.0]}] is of type class java.util.LinkedHashMap is not supported
Display stack trace? [yN] y
java.lang.IllegalArgumentException: Property value [{type=Point, coordinates=[33.0, 32.0]}] is of type class java.util.LinkedHashMap is not supported
    at org.apache.tinkerpop.gremlin.structure.Property$Exceptions.dataTypeOfPropertyValueNotSupported(Property.java:159)
    at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.verifyAttribute(StandardTitanTx.java:564)
    at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:716)
    at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.property(AbstractVertex.java:142)
    at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.property(AbstractVertex.java:23)
    at org.apache.tinkerpop.gremlin.structure.util.Attachable$Method.lambda$createVertex$26(Attachable.java:296)

Please any solutions .. .?

Upvotes: 1

Views: 376

Answers (1)

Jason Plurad
Jason Plurad

Reputation: 6792

It looks like you are running into this Issue 1183: Titan 1.0.0 GraphSONWriter.writeGraph JsonMappingException, which has already been fixed. Try building the titan11 branch from source code. If you need directions for building it, review the steps in this Titan mailing list post.

If you want to patch the Titan 1.0.0 build with the serialization fix and not move up to titan11, try this instead (discussed here):

git clone https://github.com/thinkaurelius/titan.git
cd titan
git checkout 1.0.0
git cherry-pick 6dfc816d821a7739398e5cebc1e999d75c866c19
mvn clean install -DskipTests=true -Dgpg.skip=true -Paurelius-release
unzip titan-dist/titan-dist-hadoop-1/target/titan-1.0.0-hadoop1.zip

Upvotes: 2

Related Questions