gzz-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz] Serializing URIs


From: Tuomas Lukka
Subject: [Gzz] Serializing URIs
Date: Tue, 10 Jun 2003 10:33:43 +0300
User-agent: Mutt/1.5.4i

Benja (or someone), could you please put in comments to explain *what*
this code in Graphs is doing?

    public static Model toModel(ConstGraph g) {
        try {
            Model m = new ModelMem();
            for (Iterator i=g.findN_XAA_Iter(); i.hasNext();) {
                Object o = i.next();
                Resource sub = m.createResource(Nodes.toString(o));

                for (Iterator j=g.findN_1XA_Iter(o); j.hasNext();) {
                    Object p = j.next();

                    String s0 = Nodes.toString(p);
                    boolean hadAlpha = false;
                    int i0 = s0.length()-1;
                    Property prop;
                    while(true) {
                        char c0 = s0.charAt(i0);
                        if(Character.isLetter(c0)) hadAlpha = true;
                        else if(Character.isDigit(c0)) hadAlpha = false;
                        else if(hadAlpha) {
                            prop = m.createProperty(s0.substring(0, i0+1),
                                             s0.substring(i0+1));
                            break;
                        } else
                            throw new Error("Cannot serialize URI: "+s0);
                        i0--;
                        if(i0 < 0)
                            throw new Error("Cannot serialize URI: "+s0);
                    }



I'm getting a test failure but since I have absolutely not the faintest
of what this is supposed to be doing, I can't track it down.

        Tuomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]