New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GML loading cannot accept scientific notation for float-type edge property #300

Closed
mbastian opened this Issue Oct 22, 2011 · 5 comments

Comments

Projects
None yet
4 participants
@mbastian
Copy link
Member

mbastian commented Oct 22, 2011

I would expect Gephi GML loader would admit scientific notations, but it doesn't. Scientific notation is prescribed in the GML official specification (see page 2):
http://www.fim.uni-passau.de/fileadmin/files/lehrstuhl/brandenburg/projekte/gml/gml-technical-report.pdf

Sample file:
graph [
directed 0

node [
    id 3719161
    label "GGNBP2"
]
node [
    id 3719150
    label "PIGW"
]
edge [
    source 3719161
    target 3719150
    CtrlRSq 0.03564458751187731
    CasePVal 0.36896971076737917
    CtrlPVal 6.870900696337445E-4
    CaseRSq 0.006731404647102828
]

]


Imported from Launchpad using lp2gh.

@sheymann

This comment has been minimized.

Copy link
Member

sheymann commented May 8, 2012

I merged your patch manually, thanks!

@sheymann sheymann closed this May 8, 2012

@eduramiba

This comment has been minimized.

Copy link
Member

eduramiba commented May 8, 2012

Hi,
The important part is just changing new Double() to Double.valueOf(), right?

One problem with the merged code is that it uses a String and += operator as a string buffer. But that is very inneficient. StringBuilder should be used.

@sheymann

This comment has been minimized.

Copy link
Member

sheymann commented May 8, 2012

No it's not so simple because of the parser of StringTokenizer:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4079180
http://docs.oracle.com/javase/6/docs/api/java/io/StreamTokenizer.html

I agree the current solution is not efficient, but it works. I'll improve it using a StringBuilder.

@eduramiba

This comment has been minimized.

Copy link
Member

eduramiba commented May 8, 2012

Oh I see, I didn't know that problem of StreamTokenizer.

@lbertelo

This comment has been minimized.

Copy link

lbertelo commented May 8, 2012

Hi,

No the important change is how to detect "6.870900696337445E-4" as a Double.
Before with StreamTokenizer, we had "6.870900696337445" as a Double and "E-4" as a String.

But you are right, it should be better to use StringBuilder. I didn't think to use it.

@mbastian mbastian added Fix Released and removed Fix Committed labels Nov 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment