Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] JSP Generator Problem resourceshape
  • From: Jan-Patrick Osterloh <osterloh@xxxxxxxx>
  • Date: Mon, 11 Nov 2019 10:48:44 +0100
  • Autocrypt: addr=osterloh@xxxxxxxx; prefer-encrypt=mutual; keydata= mQINBFaYzvABEAC6kSTwexU5Zme4Zc21MF2Zy+fsv8/nLPVgeTTGCY/3RJEoqpMzd+Ox7JR3 iSMkItkxTHu6Giw8YcMNbTM5ptoSTryDRMjLXvvMTmaWhPBlv66gvy6KJwfLawkQAubJKj32 rh1/7r9eT4s7iDSTLcabyHHx/9Ogvhm7feRwOvRB9u7ukcI7m4fEDZscvVZKwlcGD3wr1OtY BQIOhhEzS6XvumVTgLBN5NgtEk5MlAmFIQaBxYDt47D1QsDu7991Z2iFTuuybqrJL0vo8PAA Sqtjo0cSQu12NqU78D3zCOG8hU+kiXKW2DdmXnmkbyH1K/yztwSpNfbbOpi17CeD1snmAAEY akTtZKkVvtTa3Xg3GQ6yU/GVxFEZ+cLDViRSStL1gi5mnRHbHY7IyoEx1W/+GYPv5ripe2aB Y9c1a9l/1bLxWXAKwbD9haCHZ19lMfvF0eGn4Li3HyB5YHnhCCapoxIJJnOuDGPvaB5H+qv1 p8cxqN7p24Z6v3NZ0b7sEtQNHnq9IvJ2sSUVpHk9hy93ZNdAg3TqrQ09kN7elXxPy3xQ5OLr Q/PZTGi8bRMSShzSm8KPZy1FKzSWbYTLOtiw6HeM2s7tl+lPVD2+UH0mWleXPfZ7iaIwKa7m XlkwUSgh2dc5LvWBVCz0LiXz1NBiqrT70czodA62l1pQYLno2wARAQABtChKYW4tUGF0cmlj ayBPc3RlcmxvaCA8b3N0ZXJsb2hAb2ZmaXMuZGU+iQJCBBMBCAAsAhsjBwsJCAcDAgEGFQgC CQoLBBYCAwECHgECF4ACGQEFAluWVmQFCQbeuvQACgkQlxtC0YJWygwFGRAAgNfQK1yfY5Wf Mzz9W0JXdQZUwEg3rR4fLMNxwpu1q7OmEF784qKJ2CI0UeiUOozOGR4T8n2HhohW4P/iYSyV dR6Dsl7N/HBXZTUU4xCIFG6nSd/x6mcHC4pclcJbSUcnqChS3+cfMHL04V3unsidhI7qNO5k qyuPHfJPEHJdSOXYgdIkEFpwG8r8FLCuMOo5EXxMBQHCzbic7UE5jt5Rnz3YirQJwfhheDkj FvAh8QUUDN9mReDu7GKZkbfJfoyantLRnwjfQOmtUoDTZpUK09GGKEQAiKtge47FS5hCihpI K8OjAeLQ4XA4ZOExtmI5MaVCLZDXlkXJJlK8zhNFgVFZbGD+WVWpvHD24NShjPrdGMn2PhtY r3Q2m54PLY2ZhpRsGYrI53CLXPDvKaDzfZa+YysBsUe7CCAMHh/ZPKJhPGO1DSSK7DS3tR3s cn84OZRH3i/oSiktjsmnx/iitfVmSt279J8keKEyGtUvsI24i6WPEpldsYaVHdh0I5LVZBn6 y4DFOuJkCOO5dqhNIJC6KnQDcRXFq0MHdeKigUjdh1Rz5IJvf0SiOvRTuhzDUbTg9972jfeF YrWbjO2DWgdAwQ3+i7CiqvPdxMceiUsagALvHvUe5tdwUtRQXFpxcqb5jMTZsY/pQJouh/jZ 0+EYnS4iDVP7vzrxLEEhY5s=
  • Delivered-to: lyo-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/lyo-dev>
  • List-help: <mailto:lyo-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=unsubscribe>
  • Openpgp: preference=signencrypt
  • User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

Hi,

I obviously wasn't aware, that a namespace has to end with "#" or "/" to work properly in LYO. IF the standard requires this, I would say the generator should check it and provide a proper error message when defining the model (or at generation time, if this is easier). If on the other hand, the standard does not say that the namespace has a specific format (i.e. namespace = URI), LYO shouldn't enforce anything, and provide a more robust solution than split('#')...

Best
Jan-Patrick


Am 10.11.2019 um 12:46 schrieb Jad El-Khoury:

Hi Andrew

 

(A meta-question: in theory “lyo-dev” is the right forum to discuss such lyo development questions. But I’m under the impression that “lyo-dev” is also a user community, which might think such details are not necessary. @All! Let’s hear from you what you think on this.)

 

Good points! One can argue that a namespace can be anything, and that it ends with anything – say “-“ or “_”. Maybe it’s fruitless to try to do any intelligent stuff, and leave it to the modeller to decide. If they did mean to add a “#”, they will realize that quickly from the generated code and fix it accordingly – as long as the generated code does not crash 😊

 

The whole point of the “split(#)” is to show a nice short name of the rdf-class in the html representation of a resourceShape. It does not really affect anything else.

 

New suggestion:

  1. Don’t manipulate the namespace string defined by the modeller. Just accept it as it is.
  2. When representing the rdf-class in HTML, provide a more robust solution than “split("#")”.
    1. Try to split by the last “#” or “/” in the string. If none found, simply present the whole string.

 

regards

______________________________

Jad El-khoury, PhD

KTH Royal Institute of Technology

School of Industrial Engineering and Management, Mechatronics Division

Brinellvägen 83, SE-100 44 Stockholm, Sweden

Phone: +46(0)8 790 6877 Mobile: +46(0)70 773 93 45

jad@xxxxxx, www.kth.se

 

From: lyo-dev-bounces@xxxxxxxxxxx <lyo-dev-bounces@xxxxxxxxxxx> On Behalf Of Andrii Berezovskyi
Sent: Saturday, 9 November 2019 14:03
To: Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
Subject: Re: [lyo-dev] JSP Generator Problem resourceshape

 

Maybe there is a better way than

 

toString().split("#")[1]

 

By the way, how will the code deal with the NS that ends with a slash?

 

--

–Andrew.

 

From: <lyo-dev-bounces@xxxxxxxxxxx> on behalf of Andrii Berezovskyi <andriib@xxxxxx>
Reply to: Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
Date: Saturday, 9 November 2019, W45 at 13:52
To: Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
Subject: Re: [lyo-dev] JSP Generator Problem resourceshape

 

Hello,

 

I don’t see any bug in the generator. There was a wrong input by a user to the namespace.

 

What we need to do:

 

1) Reject user input before generating code.

2) Give the user help, explaining what is the right input.

3) Figure out why a “different” URI caused any exception. Lyo Core should not be throwing NPEs or IOOBs; that’s a real bug.

 

--

Andrew

 


From: lyo-dev-bounces@xxxxxxxxxxx on behalf of Jad El-Khoury <jad@xxxxxx>
Sent: Saturday, November 9, 2019 1:12 PM
To: Lyo project developer discussions
Subject: Re: [lyo-dev] JSP Generator Problem resourceshape

 

Hi Jan-Patrick

Please see https://github.com/eclipse/lyo.designer/issues/129 for a simple workaround to avoid the exception you mention below. It's a bug that I will fix, but it's actually a good idea for you anyway to add a "#" at the end of the namespace anyway.

@all!
For those interested, I am continuing this dialog under two issues in Lyo Github. Feel free to subscribe to notifications there if interested:
Bug in vocabulary terms: https://github.com/eclipse/lyo.designer/issues/129
Control over JSP generation: https://github.com/eclipse/lyo.designer/issues/128

regards
______________________________
Jad El-khoury, PhD
KTH Royal Institute of Technology
School of Industrial Engineering and Management, Mechatronics Division
Brinellvägen 83, SE-100 44 Stockholm, Sweden
Phone: +46(0)8 790 6877 Mobile: +46(0)70 773 93 45
jad@xxxxxx, www.kth.se

-----Original Message-----
From: lyo-dev-bounces@xxxxxxxxxxx <lyo-dev-bounces@xxxxxxxxxxx> On Behalf Of Jan-Patrick Osterloh
Sent: Thursday, 7 November 2019 14:12
To: lyo-dev@xxxxxxxxxxx
Subject: [lyo-dev] JSP Generator Problem resourceshape

Hi everybody,

when I generate my project from scratch (I deleted all jsp files to get current versions of the files after I added more properties to my resources), then there is one problem in the resourceshape.jsp. It generates the following code in the "Describes" section:

79:                         <%for(URI next :
aResourceShape.getDescribes()) {%>
80:                             <li>
81:                                 <a href="">
82:                                     <%= next.toString().split("#")[1]%></a>
83:                             </li>
84:                         <%}%>
85:                     </ul>

My "Describes" are all "null", because I didnt set this property.
Side note: I can't set it because the editor just tells me "Please select a valid 'Class'", but I don't have anything in my project that is accepted as a valid class...

Nevertheless, if I then open any of the ResourceShapes in my model (.../services/resourceShapes/<ResourceShape>, I get an Exception:

An exception occurred processing JSP page /package/resourceshape.jsp at line 82 ...
java.lang.ArrayIndexOutOfBoundsException: 1
        at
org.apache.jsp.package.resourceshape_jsp._jspService(resourceshape_jsp.java:184)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

I have removed the for loop completely and this "fixes" the problem, but I think that might be better fixed in the generator template...

Best
Jan-Patrick

P.S. Is there an option to always regenerate the jsps? I just use them for "debugging", so from my point of view they could be updated...?

--
Dipl. Inform. Jan-Patrick Osterloh
Senior Research Engineer
Human Centered Design Group

OFFIS e.V. - Institut für Informatik | Institute for Information Technology
FuE Bereich Verkehr | R&D Division Transportation
Escherweg 2, 26121 Oldenburg - Germany
Room: D107
Phone/Fax: +49 441 97 22-524 / -502
E-Mail: osterloh@xxxxxxxx
URL: http://www.offis.de

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
Prof. Dr. techn. Susanne Boll-Westermann,
Prof. Dr.-Ing. Axel Hahn,
Prof. Dr.-Ing. Andreas Hein,
Prof. Dr. Sebastian Lehnhoff

Unsere Hinweise zum Datenschutz sind abrufbar unter:
https://www.offis.de/datentransparenz.html

_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/lyo-dev
_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev


_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev

-- 
Dipl. Inform. Jan-Patrick Osterloh
Senior Research Engineer
Human Centered Design Group

OFFIS e.V. - Institut für Informatik | Institute for Information Technology
             FuE Bereich Verkehr     | R&D Division Transportation
             Escherweg 2, 26121 Oldenburg - Germany
Room:        D107
Phone/Fax:   +49 441 97 22-524 / -502
E-Mail:      osterloh@xxxxxxxx
URL:         http://www.offis.de 

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
          Prof. Dr. techn. Susanne Boll-Westermann,
          Prof. Dr.-Ing. Axel Hahn,
          Prof. Dr.-Ing. Andreas Hein,
          Prof. Dr. Sebastian Lehnhoff 

Unsere Hinweise zum Datenschutz sind abrufbar unter: 
https://www.offis.de/datentransparenz.html

Back to the top