【问题标题】:Token error with groovy in NetBeansNetBeans 中 groovy 的令牌错误
【发布时间】:2015-08-11 13:51:33
【问题描述】:

最初,我是在一个简单的文本编辑器中开发我的 groovy 代码,但我通过 NetBeans 设置了版本控制,因此将我的代码转移了。但是,我在实际运行良好的代码上收到“意外令牌”错误。

class PWLoad {

def conf = new BaseConfiguration() {{
        setProperty("storage.backend", "cassandra")
        setProperty("storage.directory", "/tmp/pw")
        setProperty("storage.batch-loading", true)
}}

def g = TitanFactory.open(conf)
def mgmt = g.getManagementSystem()

//This will be generated as "feature_type:geneId"
def objectId = mgmt.makePropertyKey('objectID').dataType(String.class).unique().make()
//Type of relationship between vertices -- all pairwise for this batch load script
def pairwise = mgmt.makeEdgeLabel('pairwise').dataType(String.class).multiplicity(Multiplicity.MULTI).make()
//Identifies these objects as bioentities, as opposed to drugs or other objects we may add later
def bioentity = mgmt.makeVertexLabel('bioentity').make();

//Vertex properties
def name = mgmt.makePropertyKey('name').dataType(String.class).make()
def chr = mgmt.makePropertyKey('chr').dataType(String.class).make()
def start = mgmt.makePropertyKey('start').dataType(Integer.class).make()
def end = mgmt.makePropertyKey('end').dataType(Integer.class).make()
def strand = mgmt.makePropertyKey('strand').dataType(Character.class).make()


/*
Edge properties -- inline comment corresponds to column #:
*/
def correlation = mgmt.makePropertyKey('correlation').dataType(Decimal.class).make() //3
def sample_size = mgmt.makePropertyKey('sample_size').dataType(Decimal.class).make() //4
def min_log_p_uncorrected = mgmt.makePropertyKey('min_log_p_uncorrected').dataType(Decimal.class).make() //5
def bonferroni = mgmt.makePropertyKey('bonferroni').dataType(Decimal.class).make() //6
def min_log_p_corrected = mgmt.makePropertyKey('min_log_p_corrected').dataType(Decimal.class).make() //7
def excluded_sample_count_a = mgmt.makePropertyKey('excluded_sample_count_a').dataType(Decimal.class).make() //8
def min_log_p_unused_a = mgmt.makePropertyKey('min_log_p_unused_a').dataType(Decimal.class).make() //9
def excluded_sample_count_b = mgmt.makePropertyKey('excluded_sample_count_b').dataType(Decimal.class).make() //10
def min_log_p_unused_b = mgmt.makePropertyKey('min_log_p_unused_b').dataType(Decimal.class).make() //11
def genomic_distance = mgmt.makePropertyKey('genomic_distance').dataType(Integer.class).make() //12


//Create index of ObjectId to speed map building

mgmt.buildIndex('byObjectId', Vertex.class).addKey(objectId).unique().buildCompositeIndex()
mgmt.commit()

g.commit()

}

我在最底部 @ mgmt.buildIndex() 处收到令牌错误。我哪里错了?

【问题讨论】:

    标签: netbeans groovy titan


    【解决方案1】:

    这可能有很多原因,但通常情况下,意外的标记错误意味着您可能有一个额外的逗号、空格或不属于那里的字符,例如在函数调用中。

    如果您知道buildIndex 期望的参数类型,则可以确定传入的字符串(即byObjectId)是否存在问题,或者是否没有正确调用任何其他链式函数。

    这曾经有效,现在无效,这可能意味着某些库没有被导入。我会为 NetBeans 中的错误打开语法突出显示,它通常会告诉您在哪里传递了一些东西,或者那里不属于那里。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-03
      • 1970-01-01
      • 1970-01-01
      • 2016-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-16
      相关资源
      最近更新 更多