Using local images for EDG customization

58 views
Skip to first unread message

Matt Goldberg

unread,
Aug 19, 2022, 5:37:37 PM8/19/22
to TopBraid Suite Users
Hello-

I already have some custom SWP elements to customize some aspects of the EDG UI, including modifying the logo on the home page. I currently have the image pulled from a network location, but it is desired to include the image with EDG and not reference a remote copy.

I seem to recall in older documentation there may have been instructions regarding how to put an image in the workspace somewhere in order to make it available to SWP and then how to reference it in SWP. Can you let me know if this is in fact possible and how to do so if it is?

Thanks!

Holger Knublauch

unread,
Aug 20, 2022, 7:27:43 AM8/20/22
to topbrai...@googlegroups.com
Hi Matt,

yes you remember correctly - there is a way to access static assets such as images from EDG applications (and SWP pages).

Just create a folder ending with .www such as myimages.www and upload this as part of a project upload into the workspace. In Studio, make sure you have refreshed the workspace, e.g. using the Refresh button on the Files page. Then you can access the content of that folder using something like tbl/lib/myimages/image.png

The general rule is that tbl/lib looks at folders ending with .www (anywhere in the workspace).

HTH
Holger


--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/29babe34-f882-4bbc-85bd-6f85ab7dcabbn%40googlegroups.com.

Matt Goldberg

unread,
Aug 22, 2022, 8:14:09 AM8/22/22
to topbrai...@googlegroups.com
Hmm, I gave this a try using Studio and it didn't seem to work. I created a folder in the workspace called logos.www, copied my images into it, refreshed the workspace (later restarted Studio), then tried to refer to the image in a ui:prototype at a path starting with tbl/lib/logos. I got a broken image icon at the places where I made the change. Am I missing something? 

Thanks.

Holger Knublauch

unread,
Aug 22, 2022, 8:28:51 AM8/22/22
to topbrai...@googlegroups.com
Is the folder on the very root of the workspace or in a project (i.e. two levels deep)? I don't think it can be at the very root of the workspace, so in this case please try to move it down. I have this


with a workspace like

What could be different for you?

Holger



Matt Goldberg

unread,
Aug 22, 2022, 8:37:42 AM8/22/22
to topbrai...@googlegroups.com
That seemed to work, thanks! 

You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/Aks_yTZT41Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/7A05042E-6649-43CE-9895-E2F1F73C9A97%40topquadrant.com.
PastedGraphic-2.png
PastedGraphic-1.png

Tim Smith

unread,
Aug 22, 2022, 3:28:13 PM8/22/22
to topbrai...@googlegroups.com
Hi,

I have been following along and I'm having issues with setting the icon for a class.  I setup the property shape per the documentation:

pgont:Physical_System-PSIcon
  a sh:PropertyShape ;
  sh:path pgont:PSIcon ;
  dash:hidden true ;
  dash:propertyRole dash:IconRole ;
  sh:datatype xsd:string ;
  sh:deactivated false ;
  sh:defaultValue "http://localhost:8084/tbl/lib/pgicons/Logical_System_icon.svg" ;
  sh:maxCount 1 ;
  sh:name "PS Icon" ;
.

I've tried multiple iterations using a truncated URL, tbl/lib/pgicons..., using xsd:string, xsd:anyURI, etc...

I noticed that the console is showing an "access denied" error (see stack trace below) yet I can access the file using the direct URI - http://localhost:8084/tbl/lib/pgicons/Logical_System_icon.svg.

At the Windows explorer level, there do not appear to be any access issues.  Am I missing something?

Thanks,

Tim

ERROR [http-nio-8084-exec-10] o.t.c.s.TBHttpServletResponse - Internal Server Error: Unexpected error in lib servlet: C:\Semantic Tools\EDG-7.3-P_07-28-2022\edg\workspace\PG.com\pgicons.www
org.topbraid.jenax.util.ExceptionUtil$1: java.lang.RuntimeException: Unexpected error in lib servlet: C:\Semantic Tools\EDG-7.3-P_07-28-2022\edg\workspace\PG.com\pgicons.www
Caused by: java.lang.RuntimeException: Unexpected error in lib servlet: C:\Semantic Tools\EDG-7.3-P_07-28-2022\edg\workspace\PG.com\pgicons.www
        at org.topbraidlive.server.servlet.LibServlet.run(LibServlet.java:123) ~[org.topbraidlive.server-7.3.0.jar:?]
        at org.topbraidlive.server.servlet.LibServlet.doGet(LibServlet.java:72) ~[org.topbraidlive.server-7.3.0.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.56.jar:4.0.FR]
        at org.topbraid.core.servlet.TBAuthEnabledServlet.serviceAuthenticated(TBAuthEnabledServlet.java:77) ~[org.topbraid.core-7.3.0.jar:?]
        at org.topbraid.core.servlet.TBAuthEnabledServlet.service(TBAuthEnabledServlet.java:44) [org.topbraid.core-7.3.0.jar:?]
        at org.topbraid.core.servlet.TBHttpServlet.service(TBHttpServlet.java:119) [org.topbraid.core-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.RemoteRequestFilter.doFilter(RemoteRequestFilter.java:56) [org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.ConcurrentUserCheckFilter.doFilter(ConcurrentUserCheckFilter.java:42) [org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.RegisteredProductFilter.doFilter(RegisteredProductFilter.java:55) [org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.ServiceAvailabilityManager$ServiceAvailabilityFilter.doFilter(ServiceAvailabilityManager.java:160) [org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.HeaderFilter.doFilter(HeaderFilter.java:33) [org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1732) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.56.jar:9.0.56]
        at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.nio.file.AccessDeniedException: C:\Semantic Tools\EDG-7.3-P_07-28-2022\edg\workspace\PG.com\pgicons.www
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) ~[?:?]
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) ~[?:?]
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) ~[?:?]
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:235) ~[?:?]
        at java.nio.file.Files.newByteChannel(Files.java:371) ~[?:?]
        at java.nio.file.Files.newByteChannel(Files.java:422) ~[?:?]
        at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420) ~[?:?]
        at java.nio.file.Files.newInputStream(Files.java:156) ~[?:?]
        at org.topbraidlive.server.servlet.LibServlet.run(LibServlet.java:112) ~[org.topbraidlive.server-7.3.0.jar:?]
        at org.topbraidlive.server.servlet.LibServlet.doGet(LibServlet.java:72) ~[org.topbraidlive.server-7.3.0.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.56.jar:4.0.FR]
        at org.topbraid.core.servlet.TBAuthEnabledServlet.serviceAuthenticated(TBAuthEnabledServlet.java:77) ~[org.topbraid.core-7.3.0.jar:?]
        at org.topbraid.core.servlet.TBAuthEnabledServlet.service(TBAuthEnabledServlet.java:44) ~[org.topbraid.core-7.3.0.jar:?]
        at org.topbraid.core.servlet.TBHttpServlet.service(TBHttpServlet.java:119) [org.topbraid.core-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.RemoteRequestFilter.doFilter(RemoteRequestFilter.java:56) ~[org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.ConcurrentUserCheckFilter.doFilter(ConcurrentUserCheckFilter.java:42) ~[org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.RegisteredProductFilter.doFilter(RegisteredProductFilter.java:55) ~[org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.ServiceAvailabilityManager$ServiceAvailabilityFilter.doFilter(ServiceAvailabilityManager.java:160) ~[org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.topbraidlive.edg.HeaderFilter.doFilter(HeaderFilter.java:33) ~[org.topbraidlive.edg.product-7.3.0.jar:?]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1732) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.56.jar:9.0.56]
        at java.lang.Thread.run(Thread.java:829) ~[?:?]

Holger Knublauch

unread,
Aug 24, 2022, 12:32:53 PM8/24/22
to topbrai...@googlegroups.com
Hi Tim,

not sure why it doesn't work for you - I tried something similar and it works fine here.

Could it be that the exception may have been from a previous attempt, where you queried the folder directly, instead of the file in the folder?

Holger


Tim Smith

unread,
Aug 24, 2022, 4:30:13 PM8/24/22
to topbrai...@googlegroups.com
Hi Holger,

I ended up restarting EDG (for other reasons) and it began working for me.  Now I have colorful icons that indicate type.

A follow-up question - is there a way to use a relative path so that I don't have to hardcode the server name in the path?  I'm working in Studio at the moment but these icons will be pushed to the server at some point.

The documentation indicates a full path is required.

Thanks,

Tim

"Constraints: The values have sh:datatype xsd:string or xsd:anyURI or sh:nodeKind sh:IRI, pointing at the absolute URL of an image with one of the mime types supported by the HTML img element. The image SHOULD be fairly small as it may be rendered into a square of anywhere between 16 and 48 pixels. Values should ideally be vector graphics such as .svg files."

Holger Knublauch

unread,
Aug 25, 2022, 3:16:12 AM8/25/22
to topbrai...@googlegroups.com

On 24 Aug 2022, at 10:29 pm, Tim Smith <smith...@gmail.com> wrote:

Hi Holger,

I ended up restarting EDG (for other reasons) and it began working for me.  Now I have colorful icons that indicate type.

Good.


A follow-up question - is there a way to use a relative path so that I don't have to hardcode the server name in the path?  I'm working in Studio at the moment but these icons will be pushed to the server at some point.

The documentation indicates a full path is required.

Practically speaking, my testing confirms that you can use relative paths such as "lib/pgicons/myicon.svg"

These would only work within TopBraid, and would likely break if you ever would want to use this icon information from 3rd party applications (unless of course you place the icons in relative folders of that application). The documentation encourages absolute URLs for platform neutrality.

Holger


Richard Cyganiak

unread,
Aug 25, 2022, 4:56:44 AM8/25/22
to topbraid-users list
Hi Tim,

> On 24 Aug 2022, at 21:29, Tim Smith <smith...@gmail.com> wrote:
>
> A follow-up question - is there a way to use a relative path so that I don't have to hardcode the server name in the path? I'm working in Studio at the moment but these icons will be pushed to the server at some point.

If constructing the URL dynamically is an option, the following SPARQL functions might be useful.

ui:appRootUrl() returns the context path of EDG (“/” if EDG is running at the server root, like in Studio; and “/edg/” if deployed in Tomcat as edg.war). This allows making correct relative URLs that start with a “/”, which will work from anywhere within the same server.

tbladmin:getConfigValue(cfg:serverURL) yields the absolute URL where EDG is running (“http://localhost:8083” in Studio). This allows making correct absolute URLs that will work from anywhere. This requires that the “Server URL” field has been correctly set in Server Configuration.

Hope that helps,
Richard

Matt Goldberg

unread,
Sep 21, 2022, 9:21:54 AM9/21/22
to TopBraid Suite Users
I forgot to add this follow up- part of what had me confused earlier on in the thread is exactly the issue mentioned above, i.e. the path is different in Studio and EDG. Using ui:appRootUrl also solved my issue such that my UI modifications worked in both Studio and EDG.
Reply all
Reply to author
Forward
0 new messages