当前位置: 首页>>代码示例>>Java>>正文


Java OrientGraphNoTx.getRawGraph方法代码示例

本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.getRawGraph方法的典型用法代码示例。如果您正苦于以下问题:Java OrientGraphNoTx.getRawGraph方法的具体用法?Java OrientGraphNoTx.getRawGraph怎么用?Java OrientGraphNoTx.getRawGraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx的用法示例。


在下文中一共展示了OrientGraphNoTx.getRawGraph方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStEquals

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testStEquals() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(
        new OCommandSQL(
            "SELECT ST_Equals(ST_GeomFromText('LINESTRING(0 0, 10 10)'), ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10)'))"))
        .execute();
    ODocument next = execute.iterator().next();
    Assert.assertEquals(next.field("ST_Equals"), true);
  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:18,代码来源:LuceneSpatialMiscFunctionsTest.java

示例2: testAsBinary

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test(enabled = false)
public void testAsBinary() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_AsBinary(ST_GeomFromText('LINESTRING(0 0, 10 10)'))"))
        .execute();
    ODocument next = execute.iterator().next();
    // TODO CHANGE
    Assert.assertNull(next.field("ST_AsBinary"));
  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:17,代码来源:LuceneSpatialMiscFunctionsTest.java

示例3: testDisjoint

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testDisjoint() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_Disjoint('POINT(0 0)', 'LINESTRING ( 2 0, 0 2 )');"))
        .execute();
    ODocument next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Disjoint"), true);

    execute = db.command(new OCommandSQL("SELECT ST_Disjoint('POINT(0 0)', 'LINESTRING ( 0 0, 0 2 )');")).execute();
    next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Disjoint"), false);
  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:22,代码来源:LuceneSpatialMiscFunctionsTest.java

示例4: testWithinNoIndex

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testWithinNoIndex() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db
        .command(
            new OCommandSQL(
                "select ST_Within(smallc,smallc) as smallinsmall,ST_Within(smallc, bigc) As smallinbig, ST_Within(bigc,smallc) As biginsmall "
                + "from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"))
        .execute();
    ODocument next = execute.iterator()
                            .next();

    Assert.assertEquals(next.field("smallinsmall"), false);
    Assert.assertEquals(next.field("smallinbig"), true);
    Assert.assertEquals(next.field("biginsmall"), false);

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:25,代码来源:LuceneSpatialWithinTest.java

示例5: testContainsNoIndex

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testContainsNoIndex() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTestNoIndex");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db
        .command(
            new OCommandSQL(
                "select ST_Contains(smallc,smallc) as smallinsmall,ST_Contains(smallc, bigc) As smallinbig, ST_Contains(bigc,smallc) As biginsmall from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"))
        .execute();
    ODocument next = execute.iterator().next();

    Assert.assertEquals(next.field("smallinsmall"), true);
    Assert.assertEquals(next.field("smallinbig"), false);
    Assert.assertEquals(next.field("biginsmall"), true);

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:23,代码来源:LuceneSpatialContainsTest.java

示例6: testIntersectsNoIndex

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testIntersectsNoIndex() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_Intersects('POINT(0 0)', 'LINESTRING ( 2 0, 0 2 )')"))
        .execute();
    ODocument next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Intersects"), false);
    execute = db.command(new OCommandSQL("SELECT ST_Intersects('POINT(0 0)', 'LINESTRING ( 0 0, 0 2 )')")).execute();
    next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Intersects"), true);

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:22,代码来源:LuceneSpatialIntersectsTest.java

示例7: testDWithinNoIndex

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testDWithinNoIndex() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(
        new OCommandSQL("SELECT ST_DWithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'), "
            + "ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0d) as distance")).execute();
    ODocument next = execute.iterator().next();

    Assert.assertEquals(next.field("distance"), true);

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:19,代码来源:LuceneSpatialDWithinTest.java

示例8: testEnvelope

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testEnvelope() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_AsText(ST_Envelope('LINESTRING(0 0, 1 3)'))")).execute();
    ODocument next = execute.iterator().next();
    Assert.assertEquals(next.field("ST_AsText"), "POLYGON ((0 0, 0 3, 1 3, 1 0, 0 0))");

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:16,代码来源:LuceneSpatialMiscFunctionsTest.java

示例9: testBuffer

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testBuffer() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_AsText(ST_Buffer(ST_GeomFromText('POINT(100 90)'),50));"))
        .execute();
    ODocument next = execute.iterator().next();
    Assert
        .assertEquals(
            next.field("ST_AsText"),
            "POLYGON ((150 90, 149.0392640201615 80.24548389919359, 146.19397662556435 70.86582838174552, 141.57348061512727 62.22148834901989, 135.35533905932738 54.64466094067263, 127.77851165098011 48.42651938487274, 119.1341716182545 43.80602337443566, 109.75451610080641 40.960735979838475, 100 40, 90.24548389919359 40.960735979838475, 80.86582838174552 43.80602337443566, 72.2214883490199 48.426519384872734, 64.64466094067262 54.64466094067262, 58.426519384872734 62.22148834901989, 53.80602337443566 70.86582838174553, 50.960735979838475 80.24548389919362, 50 90.00000000000004, 50.96073597983849 99.75451610080646, 53.80602337443568 109.13417161825454, 58.426519384872776 117.77851165098016, 64.64466094067268 125.35533905932743, 72.22148834901996 131.57348061512732, 80.8658283817456 136.19397662556437, 90.2454838991937 139.03926402016154, 100.00000000000013 140, 109.75451610080654 139.0392640201615, 119.13417161825463 136.1939766255643, 127.77851165098025 131.57348061512718, 135.3553390593275 125.35533905932726, 141.57348061512735 117.77851165097996, 146.1939766255644 109.13417161825431, 149.03926402016157 99.75451610080621, 150 90))");

    execute = db.command(new OCommandSQL("SELECT ST_AsText(ST_Buffer(ST_GeomFromText('POINT(100 90)'), 50, { quadSegs : 2 }));"))
        .execute();
    next = execute.iterator().next();

    Assert
        .assertEquals(
            next.field("ST_AsText"),
            "POLYGON ((150 90, 135.35533905932738 54.64466094067263, 100 40, 64.64466094067262 54.64466094067262, 50 90, 64.64466094067262 125.35533905932738, 99.99999999999999 140, 135.35533905932738 125.35533905932738, 150 90))");

    execute = db.command(
        new OCommandSQL(
            "SELECT ST_AsText(ST_Buffer(ST_GeomFromText('LINESTRING(0 0,75 75,75 0)'), 10, { 'endCap' : 'square' }));"))
        .execute();
    next = execute.iterator().next();
    Assert
        .assertEquals(
            next.field("ST_AsText"),
            "POLYGON ((67.92893218813452 82.07106781186548, 69.44429766980397 83.31469612302546, 71.1731656763491 84.23879532511287, 73.04909677983872 84.80785280403231, 75 85, 76.95090322016128 84.80785280403231, 78.8268343236509 84.23879532511287, 80.55570233019603 83.31469612302546, 82.07106781186548 82.07106781186548, 83.31469612302546 80.55570233019603, 84.23879532511287 78.8268343236509, 84.80785280403231 76.95090322016128, 85 75, 85 0, 84.80785280403231 -1.9509032201612824, 84.23879532511287 -3.826834323650898, 83.31469612302546 -5.555702330196022, 82.07106781186548 -7.071067811865475, 80.55570233019603 -8.314696123025453, 78.8268343236509 -9.238795325112868, 76.95090322016128 -9.807852804032304, 75 -10, 73.04909677983872 -9.807852804032304, 71.1731656763491 -9.238795325112868, 69.44429766980397 -8.314696123025453, 67.92893218813452 -7.0710678118654755, 66.68530387697454 -5.555702330196022, 65.76120467488713 -3.8268343236508944, 65.19214719596769 -1.9509032201612773, 65 0, 65 50.85786437626905, 7.071067811865475 -7.071067811865475, 5.555702330196023 -8.314696123025453, 3.8268343236508984 -9.238795325112868, 1.9509032201612833 -9.807852804032304, 0.0000000000000006 -10, -1.950903220161282 -9.807852804032304, -3.826834323650897 -9.238795325112868, -5.55570233019602 -8.314696123025453, -7.071067811865475 -7.0710678118654755, -8.314696123025453 -5.555702330196022, -9.238795325112868 -3.826834323650899, -9.807852804032304 -1.9509032201612861, -10 -0.0000000000000012, -9.807852804032304 1.9509032201612837, -9.238795325112866 3.8268343236509006, -8.314696123025449 5.555702330196026, -7.071067811865475 7.071067811865475, 67.92893218813452 82.07106781186548))");

  } finally {
    graph.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:39,代码来源:LuceneSpatialMiscFunctionsTest.java

示例10: testDistance

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testDistance() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    List<ODocument> execute = db
        .command(
            new OCommandSQL(
                "SELECT ST_Distance(ST_GeomFromText('POINT(-72.1235 42.3521)'),ST_GeomFromText('LINESTRING(-72.1260 42.45, -72.123 42.1546)'))"))
        .execute();
    ODocument next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Distance"), 0.0015056772638228177);

    execute = db
        .command(
            new OCommandSQL(
                "SELECT  ST_Distance( ST_GeomFromText('LINESTRING(13.45 52.47,13.46 52.48)'), ST_GeomFromText('LINESTRING(13.00 52.00,13.1 52.2)'))"))
        .execute();
    next = execute.iterator().next();

    Assert.assertEquals(next.field("ST_Distance"), 0.44204072210600415);
  } finally {
    graph.drop();
  }

}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:30,代码来源:LuceneSpatialMiscFunctionsTest.java

示例11: testDoubleLucene

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testDoubleLucene() {
  OrientGraphNoTx graph = new OrientGraphNoTx("memory:doubleLucene");
  ODatabaseDocumentTx db = graph.getRawGraph();

  db.command(new OCommandSQL("create class Test extends V")).execute();
  db.command(new OCommandSQL("create property Test.attr1 string")).execute();
  db.command(new OCommandSQL("create index Test.attr1 on Test (attr1) fulltext engine lucene")).execute();
  db.command(new OCommandSQL("create property Test.attr2 string")).execute();
  db.command(new OCommandSQL("create index Test.attr2 on Test (attr2) fulltext engine lucene")).execute();
  db.command(new OCommandSQL("insert into Test set attr1='foo', attr2='bar'")).execute();
  db.command(new OCommandSQL("insert into Test set attr1='bar', attr2='foo'")).execute();

  List<ODocument> results = db.command(new OCommandSQL("select from Test where attr1 lucene 'foo*' OR attr2 lucene 'foo*'"))
      .execute();
  Assert.assertEquals(results.size(), 2);

  results = db.command(new OCommandSQL("select from Test where attr1 lucene 'bar*' OR attr2 lucene 'bar*'")).execute();

  Assert.assertEquals(results.size(), 2);

  results = db.command(new OCommandSQL("select from Test where attr1 lucene 'foo*' AND attr2 lucene 'bar*'")).execute();

  Assert.assertEquals(results.size(), 1);

  results = db.command(new OCommandSQL("select from Test where attr1 lucene 'bar*' AND attr2 lucene 'foo*'")).execute();

  Assert.assertEquals(results.size(), 1);

}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:31,代码来源:DoubleLuceneTest.java

示例12: testUpdate

import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入方法依赖的package包/类
@Test
public void testUpdate() {

  OrientGraphNoTx graph = new OrientGraphNoTx("memory:doubleLucene");
  try {
    ODatabaseDocumentTx db = graph.getRawGraph();

    db.command(new OCommandSQL("create class City extends V")).execute();

    db.command(new OCommandSQL("create property City.location embedded OPoint")).execute();

    db.command(new OCommandSQL("CREATE INDEX City.location ON City(location) SPATIAL ENGINE LUCENE")).execute();
    db.command(
        new OCommandSQL("insert into City set name = 'Test' , location = ST_GeomFromText('POINT(-160.2075374 21.9029803)')"))
        .execute();

    OIndex<?> index = db.getMetadata().getIndexManager().getIndex("City.location");

    db.command(new OCommandSQL("update City set name = 'Test' , location = ST_GeomFromText('POINT(12.5 41.9)')")).execute();

    Assert.assertEquals(index.getSize(), 1);

  } finally {
    graph.drop();
  }

}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:28,代码来源:LuceneGeoUpdateTest.java


注:本文中的com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.getRawGraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。