Search in sources :

Example 6 with OGraphMLReader

use of com.orientechnologies.orient.graph.graphml.OGraphMLReader in project orientdb by orientechnologies.

the class OGremlinConsoleTest method testGraphMLImportIgnoreVAttribute.

@Test
public void testGraphMLImportIgnoreVAttribute() throws IOException {
    final String INPUT_FILE = "src/test/resources/graph-example-fromexport.xml";
    String dbUrl = "memory:testGraphMLImportIgnoreVAttribute";
    final OGraphMLReader graphml = new OGraphMLReader(new OrientGraphNoTx(dbUrl)).defineVertexAttributeStrategy("__type__", new OIgnoreGraphMLImportStrategy()).inputGraph(INPUT_FILE);
    ODatabaseDocumentTx db = new ODatabaseDocumentTx(dbUrl);
    db.open("admin", "admin");
    try {
        List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from V"));
        Assert.assertFalse(result.isEmpty());
        for (ODocument d : result) {
            Assert.assertFalse(d.containsField("__type__"));
        }
    } finally {
        db.close();
    }
}
Also used : OIgnoreGraphMLImportStrategy(com.orientechnologies.orient.graph.graphml.OIgnoreGraphMLImportStrategy) OGraphMLReader(com.orientechnologies.orient.graph.graphml.OGraphMLReader) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OrientGraphNoTx(com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Aggregations

OGraphMLReader (com.orientechnologies.orient.graph.graphml.OGraphMLReader)6 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)5 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)5 OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)5 Test (org.junit.Test)5 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)2 OGraphSONReader (com.orientechnologies.orient.graph.graphml.OGraphSONReader)2 OIgnoreGraphMLImportStrategy (com.orientechnologies.orient.graph.graphml.OIgnoreGraphMLImportStrategy)2 ConsoleCommand (com.orientechnologies.common.console.annotation.ConsoleCommand)1 OCommandOutputListener (com.orientechnologies.orient.core.command.OCommandOutputListener)1 ODatabaseImportException (com.orientechnologies.orient.core.db.tool.ODatabaseImportException)1 ORenameGraphMLImportStrategy (com.orientechnologies.orient.graph.graphml.ORenameGraphMLImportStrategy)1 OrientGraph (com.tinkerpop.blueprints.impls.orient.OrientGraph)1 GraphSONWriter (com.tinkerpop.blueprints.util.io.graphson.GraphSONWriter)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 List (java.util.List)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 ZipInputStream (java.util.zip.ZipInputStream)1