On 17/01/15 00:55, Stian Soiland-Reyes wrote:
Just relax - custom property functions work well in Fuseki 2. (which
is presumably something along the lines of what Trevor wants to add).

I tested a custom function with Fuseki 2 WAR deployed in Tomcat 7:

     PREFIX arq: <java:arq.examples.propertyfunction.>
     SELECT ?s ?name WHERE { ?s arq:localname ?name }

works perfectly.

I added localname.jar to WEB-INF/lib/ as Trevor suggests:

     sudo jar -uf /var/lib/tomcat7/webapps/fuseki.war WEB-INF/lib/localname.jar

(You have to place the JAR in an empty subfolder WEB-INF/lib/first)


Tomcat should restart the application automatically when the .war is updated.

(I made localname.jar from the jena-arq/src-examples. I had to do the
last bit old-skool with javac and jar as there was no pom.xml for the
examples  :( )


# fuseki dist

Installing custom JARs to fuseki 1 or in the Fuseki 2
jena-fuseki2/jena-fuseki-dist distribution seems to be a bit trickier,
as you have to edit the launcher scripts fuseki-server or
fuseki-server.bat to modify the java -classpath.

(Even then I could not get this to work, but I didn't try very hard).


You can modify the fuseki-server.jar -- it's a shared jar executable jar (another way that code likes to get sealed) so add in .class files with the additional code, not adding a file to an archive,

Another way, which avoids hacking the server jar, is to use the fuseki-server jar as a normal component of the classpath:

java ... -cp "fuseki-server.jar:MoreStuff.jar" \
    org.apache.jena.fuseki.cmd.FusekiCmd  "$@"


That also works as a self contained jar to run command line stuff:

java -cp fuseki-server.jar arq.sparql --version

        Andy

(notes now in the scripts)


On 16 January 2015 at 16:14, Stian Soiland-Reyes <[email protected]> wrote:
Presumably one would always have to do the WEB-INF/lib trick to add
custom ARQ Filter functions?

https://jena.apache.org/documentation/query/extension.html#value-functions


(.. as the functions would need access to the interface
com.hp.hpl.jena.sparql.pfunction.PFuncAssignToObject from the webapp
classloader that holds jena-arq.jar and friends)



Does https://jena.apache.org/documentation/query/java-uri.html even
work within Fuseki 2 as a WAR?

com.hp.hpl.jena.sparql.util.Loader uses Class.forName() ...

On 16 January 2015 at 15:10, John A. Fereira <[email protected]> wrote:

Sounds good.  So, did it work?

Documenting this somewhere would probably be useful.

-----Original Message-----
From: Trevor Donaldson [mailto:[email protected]]
Sent: Friday, January 16, 2015 10:02 AM
To: [email protected]
Subject: Re: Third Party Libraries in Fuseki 2

Thanks Stian, John, and Andy. I actually went with jar -uf <war> 
WEB-INF/lib/<custom.jar>

On Fri, Jan 16, 2015 at 9:48 AM, Andy Seaborne <[email protected]> wrote:

If you want additional jars/classes AND in war file form, I think it
needs some small amount of self-assembly.

You may be able to take the war file distributed and add your extra
jars (it is a zip file; or "jar -u") I've not tried - just read some
page like
http://linuxproblems.org/wiki/Add_or_update_files_in_a_war_file
:-)

With maven, you can probably do that, or have your own war builder
with the same dependency of jena-fuseki-core as the delivery module.

         Andy


On 16/01/15 13:59, Stian Soiland-Reyes wrote:

It should be safest to do the second option of WEB-INF/lib -
otherwise you might have to ensure that everything your JAR in
tomcat/lib requires is also in tomcat/lib (even if it is in
WEB-INF/lib) - which could cause conflicts.



On 16 January 2015 at 02:46, Trevor Donaldson <[email protected]>
wrote:

Ok thanks.
On Jan 15, 2015 9:05 PM, "John A. Fereira" <[email protected]> wrote:

  That depends on what you're using for your servlet container.  When
I
use
jetty I just create a lib directory in the directory where I've
downloaded fuseki, and  drop any jar files there (for example, if/**
* Framework for implementaing a Transactional which is compromised of a number
 * of TransactionalComponents
 * */

you want to connect to an sdb that's where the sdb jar file would
go.  Then the start up script just needs to include those jar files
in the classpath.  If you're deploying to Tomcat the easiest way is
to use jar to expand the fuseki.war
file.  Then you should see a WEB-INF/lib directory.   Drop your jar file
then the re-create the war file with the jar command.


-----Original Message-----
From: Trevor Donaldson [mailto:[email protected]]
Sent: Thursday, January 15, 2015 8:21 PM
To: [email protected]
Subject: Third Party Libraries in Fuseki 2

Where should I place third party libraries in Fuseki2? I am using
fuseki.war. I would like to use a custom shiro realm. I am not sure
where to place the custom.jar.

Thanks









--
Stian Soiland-Reyes
Apache Taverna (incubating)
http://orcid.org/0000-0001-9842-9718




Reply via email to