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

Hi

 

There is certainly no requirement that it must end with a # or /. But it is good practice.

 

The problem here is restricted to the html that tries to display the “describes” property in a user friendly way. I made a pull request to make this more robust, so that it does not raise an exception. As soon as it is reviewed, it should be released

https://github.com/eclipse/lyo.designer/pull/130

 

Note that if you specify a namespace of "http://your.domain.com/ns" and class named "someName", then your full class name will be http://your.domain.com/nssomeName. Why doesn’t the generator add a “/”? Well, maybe you want it to add a “#”, or a “-“, or ….

So maybe best to simply accept what the model specifies. One can then adjust the model to get the expected results.

 

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 Jan-Patrick Osterloh
Sent: 11 November 2019 10:49
To: lyo-dev@xxxxxxxxxxx
Subject: Re: [lyo-dev] JSP Generator Problem resourceshape

 

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