You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Arunkumar Krishnamoorthy <ak...@ncsu.edu> on 2018/08/06 18:09:45 UTC

Writing an ARQ Extension Function

Hello All,

I am following the link below to write an ARQ extension function,

https://blog.ldodds.com/2005/11/07/writing-an-arq-extension-function/

Please find the query i have given,

PREFIX myfn: <java:samplejena.>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?title ?r
WHERE {
?s rdfs:seeAlso ?r.
OPTIONAL {?r dc:title ?title.}
FILTER ( isURI(?r) &&
myfn:LastModified(?r) >
xsd:dateTime('2005-11-06T00:00:00Z') )
}

And i execute the following command to run the query for the dataset,

/home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
/home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq

I am getting the error as,

*ak@akrish12:~$* /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
/home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq

14:07:07 WARN  ClsLoader            :: Class not found:
samplejena.LastModified
14:07:07 WARN  exec                 :: URI <java:samplejena.LastModified>
has no registered function factory
-------------
| title | r |
=============
-------------

I have added the classpath in the location /home/ak/Documents and the jar
of the file
LastModified in the same location.

Could someone please help me to resolve this issue.

Regards,
Arun

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.

On 10/08/18 14:57, Arunkumar Krishnamoorthy wrote:
> So i need to change this function to dateTime?,
> 
> NodeValue date = NodeValue.makeDate(lastModified);
> 
> is "make date"

That is something you can try in your program - rather than email.

Please also read the javadoc for URLConnection.getLastModifed.



> 
> On Fri, Aug 10, 2018 at 9:51 AM, Andy Seaborne <an...@apache.org> wrote:
> 
>>
>>
>> On 10/08/18 14:36, Arunkumar Krishnamoorthy wrote:
>>
>>> Even i don't know where that particular date is coming from. The dataset
>>> is attached.
>>>
>>
>> if it is not in the data and not in query, then it is in your code.
>>
>> What about URLConnection.getLastModifed?
>>
>> NB: You are in timezone +05:00 judging by ncsu.edu.

-05:00

>>
>> 1969-12-31T19:00:00 +05:00
>>
>> is
>>
>> 1970-01-01T00:00:00
>>
>> which 0 in Unix time.
>>
>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>> Isn't a date, it's dateTime format.
>>
>>>>
>> NodeValue date = NodeValue.makeDate(lastModified);
>>
>> is "make date"
>>
>>      Andy
>>
>>
>>>
>>> On Fri, Aug 10, 2018 at 3:57 AM, Andy Seaborne <andy@apache.org <mailto:
>>> andy@apache.org>> wrote:
>>>
>>>      >> But i have given the type as xsd:dateTime, so it should take it
>>> right?
>>>
>>>      The computer says otherwise.
>>>
>>>      >>myfn:LastModified(?r) >
>>>      >> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>>
>>>        "2005-11-06T00:00:00Z"^^xsd:dateTime  is OK
>>>
>>>      >> "1969-12-31T19:00:00"^^xsd:date
>>>
>>>      Not OK. Find out where "1969-12-31T19:00:00" comes from. Is it in
>>>      the data?
>>>
>>>           Andy
>>>
>>>
>>>
>>>
>>>      On 10/08/18 06:53, Lorenz Buehmann wrote:
>>>
>>>          which type? in the function or in the data? both have to match,
>>>          there is
>>>          no implicit conversion I guess.
>>>
>>>
>>>          On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
>>>
>>>              But i have given the type as xsd:dateTime, so it should take
>>>              it right?
>>>
>>>              On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <ajs6f@apache.org
>>>              <ma...@apache.org>> wrote:
>>>
>>>                      13:44:11 WARN  NodeValue            :: Datatype
>>>                      format exception:
>>>                      "1969-12-31T19:00:00"^^xsd:date
>>>
>>>                  No, Jena is just telling you (quite correctly) that
>>>                  "1969-12-31T19:00:00"
>>>                  is not an xsd:date. Notice the time that is included.
>>>                  xsd:date does not
>>>                  include time.
>>>
>>>                  ajs6f
>>>
>>>                      On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy
>>>                      <akrish12@ncsu.edu <ma...@ncsu.edu>>
>>>
>>>                  wrote:
>>>
>>>                      Hello Andy,
>>>
>>>                      I am getting the below error when i run the query
>>>                      against the dataset
>>>                      shared with you,
>>>
>>>                      PREFIX myfn: <java:samplejena.>
>>>                      PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#
>>>                      <http://www.w3.org/2000/01/rdf-schema#>>
>>>                      PREFIX dc: <http://purl.org/dc/elements/1.1/
>>>                      <http://purl.org/dc/elements/1.1/>>
>>>                      PREFIX xsd: <http://www.w3.org/2001/XMLSchema#
>>>                      <http://www.w3.org/2001/XMLSchema#>>
>>>                      SELECT ?title ?r
>>>                      WHERE {
>>>                      ?s rdfs:seeAlso ?r.
>>>                      OPTIONAL {?r dc:title ?title.}
>>>                      FILTER ( isURI(?r) &&
>>>                      myfn:LastModified(?r) >
>>>                      "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>>                      }
>>>
>>>                      13:44:11 WARN  NodeValue            :: Datatype
>>>                      format exception:
>>>                      "1969-12-31T19:00:00"^^xsd:date
>>>
>>>                      Is this because of any old version or something?
>>>
>>>
>>>
>>>                      On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne
>>>                      <andy@apache.org <ma...@apache.org>> wrote:
>>>
>>>                          Good question - there is still a noticeable tail
>>>                          of com.hp.hpl, here and
>>>                          on Stackoverflow.
>>>
>>>                          Some is due to old apps; that is good in that
>>>                          the software is useful
>>>                          enough to be used for such a long time.
>>>
>>>                          I suspect that some of the rest is university
>>>                          courses providing the
>>>                          materials that have not been updated.
>>>
>>>                          (Jena3 was 2015-07-29)
>>>
>>>                               Andy
>>>
>>>
>>>                          On 09/08/18 06:48, Lorenz Buehmann wrote:
>>>
>>>                              I'm always wondering how people that are new
>>>                              to Apache Jena still use
>>>                              the old version. I mean, the first hit via
>>>                              Google is the Apache Jena
>>>                              webpage which clearly refers to the latest
>>>                              version.
>>>
>>>                              In the current case, he just copied the code
>>>                              example from [1] which
>>>                              indeed uses the old version given that the
>>>                              blog entry is from 2005.
>>>                              Well, at this time I didn't know about
>>>                              Semantic Web at all...
>>>
>>>                              [1]
>>>                              http://www.ldodds.com/projects
>>> /sparql/LastModified.txt
>>>                              <http://www.ldodds.com/project
>>> s/sparql/LastModified.txt>
>>>
>>>
>>>                              On 08.08.2018 22:14, Andy Seaborne wrote:
>>>
>>>                                  com.hp.hpl.jena -- that's Jena2.
>>>
>>>                                  Packages are "org.apache.jena" in Jena3.
>>>
>>>                                  The code seems to have been compiled
>>>                                  against Jena2 and run against
>>>                                  Jena3.  That won't work.
>>>
>>>                                        Andy
>>>
>>>                                  On 08/08/18 18:14, Arunkumar
>>>                                  Krishnamoorthy wrote:
>>>
>>>                                      The java code i am executing is,
>>>
>>>                                      package samplejena;
>>>
>>>                                      import
>>>                                      com.hp.hpl.jena.query.expr.NodeValue;
>>>                                      import
>>>                                      com.hp.hpl.jena.query.function
>>> .FunctionBase1;
>>>
>>>                                      import java.net.*;
>>>                                      import java.text.SimpleDateFormat;
>>>                                      import java.util.*;
>>>
>>>                                      public class LastModified extends
>>>                                      FunctionBase1
>>>                                      {
>>>                                      private static final
>>>                                      SimpleDateFormat format = new
>>>                                      SimpleDateFormat("yyyy-MM-dd'T
>>> 'HH:mm:ss");
>>>                                      private Map _cache;
>>>                                      public LastModified()
>>>                                      {
>>>                                      _cache = new HashMap();
>>>                                      }
>>>                                      public NodeValue exec(NodeValue
>>>                                      nodeValue)
>>>                                      {
>>>                                      String value = nodeValue.asString();
>>>                                      if (_cache.containsKey(value))
>>>                                      {
>>>                                      return (NodeValue)_cache.get(value);
>>>                                      }
>>>                                                 String lastModified = "";
>>>                                      try {
>>>                                      lastModified = getLastModified(
>>>                                      nodeValue.asString() );
>>>                                      } catch (Exception e) {
>>>                                      // TODO Auto-generated catch block
>>>                                      e.printStackTrace();
>>>                                      }
>>>
>>>                                                 NodeValue date =
>>>                                      NodeValue.makeDate(lastModified);
>>>                                                 _cache.put(value, date);
>>>                                                 return date;
>>>                                      }
>>>                                      public String getLastModified(String
>>>                                      link) throws Exception
>>>                                      {
>>>                                      URL url = new URL(link);
>>>                                      URLConnection connection =
>>>                                      url.openConnection();
>>>                                      connection.setAllowUserInterac
>>> tion(false);
>>>                                      long secs =
>>>                                      connection.getLastModified();
>>>                                      String xsdDate = dateToXSD(secs);
>>>                                      return xsdDate;
>>>                                      }
>>>                                      public String dateToXSD(long secs)
>>>                                      {
>>>                                      Date date = new Date(secs);
>>>                                      return format.format(date);
>>>                                      }
>>>                                      }
>>>
>>>
>>>
>>>                                      On Wed, Aug 8, 2018 at 1:14 PM,
>>>                                      Arunkumar Krishnamoorthy
>>>                                      <akrish12@ncsu.edu
>>>                                      <ma...@ncsu.edu>>
>>>                                      wrote:
>>>
>>>                                      Hello Andy,
>>>
>>>                                          I am getting the following issue
>>>                                          when i run the code,
>>>
>>>                                          Caused by:
>>>                                          java.lang.ClassNotFoundException:
>>> com.hp.hpl.jena.query.
>>>                                          function.FunctionBase1
>>>                                          at
>>>                                          java.net.URLClassLoader.findCl
>>> ass(URLClassLoader.java:381)
>>>                                          at
>>>                                          java.lang.ClassLoader.loadClas
>>> s(ClassLoader.java:424)
>>>                                          at
>>>                                          sun.misc.Launcher$AppClassLoad
>>> er.loadClass(Launcher.j
>>>
>>>                                          I have added the .class file in
>>>                                          the directory. Do i need to
>>> package
>>>
>>>                  the
>>>
>>>                                          dependancy jars also? Please
>>> advice.
>>>
>>>                                          Regards,
>>>                                          Arun
>>>
>>>                                          On Tue, Aug 7, 2018 at 2:11 PM,
>>>                                          Arunkumar Krishnamoorthy <
>>>                                          akrish12@ncsu.edu
>>>                                          <ma...@ncsu.edu>>
>>> wrote:
>>>
>>>                                          It is executing now Andy. Thanks
>>>                                          a lot. I missed to add the
>>>
>>>                  directory.
>>>
>>>                                              Thanks again for this help.
>>>
>>>                                              On Tue, Aug 7, 2018 at 2:06
>>>                                              PM, Andy Seaborne
>>>                                              <andy@apache.org
>>>                                              <ma...@apache.org>>
>>>
>>>                                              wrote:
>>>
>>>
>>>                                                  On 07/08/18 18:07,
>>>                                                  Arunkumar Krishnamoorthy
>>>                                                  wrote:
>>>
>>>                                                  So my JENA_CP
>>>
>>>                                                      is
>>>
>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>                                                      /Documents'.
>>>
>>>
>>>                                                  Does the file
>>>
>>>
>>> /home/ak/Documents/samplejena/LastModified.class
>>>
>>>                                                  exist?
>>>
>>>
>>>
>>>                                                  /home/ak/Documents
>>>                                                  location has the
>>>                                                  classfile/jar of the code
>>>
>>>                                                      But still when i run
>>>                                                      this command,
>>>
>>>
>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>>                                                      --data
>>>
>>> /home/ak/Desktop/dataset.rdf
>>>                                                      --query
>>>
>>> /home/ak/Desktop/query.rq
>>>
>>>                                                      I am getting the
>>>                                                      below error,
>>>
>>>                                                      ak@akrish12:~$
>>>
>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>>
>>>                  --data
>>>
>>>
>>> /home/ak/Desktop/dataset.rdf
>>>                                                      --query
>>>
>>> /home/ak/Desktop/query.rq
>>>                                                      12:41:35 WARN
>>>                                               ClsLoader
>>>                                           :: Class not found:
>>>
>>> samplejena.LastModified
>>>                                                      12:41:35 WARN  exec
>>>                                                                     :: URI
>>>
>>> <java:samplejena.LastModified>
>>>                                                      has no registered
>>>                                                      function factory
>>>                                                      -------------
>>>                                                      | title | r |
>>>                                                      =============
>>>                                                      -------------
>>>
>>>
>>>                                                      Regards,
>>>                                                      Arun
>>>
>>>                                                      On Tue, Aug 7, 2018
>>>                                                      at 12:20 PM, Andy
>>>                                                      Seaborne
>>>                                                      <andy@apache.org
>>>                                                      <mailto:
>>> andy@apache.org>>
>>>
>>>                                                      wrote:
>>>
>>>                                                      The list doesn't
>>>                                                      accept attachments.
>>>
>>>
>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>
>>>                                                              This needs
>>>                                                              to be a
>>>                                                              valid java
>>>                                                              classpath.
>>>
>>>                                                          $JENA_HOME is
>>>                                                          directory of the
>>>                                                          Jena installation.
>>>
>>>                                                          In the original
>>>                                                          it says:
>>>
>>>
>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>
>>>                                                          the .../lib/*
>>>                                                          (NB single
>>>                                                          quotes - no *
>>>                                                          expansion) puts
>>>                                                          all the
>>>                                                          jars in
>>>                                                          that direct on
>>>                                                          the classpath.
>>>
>>>                                                          For you:
>>>
>>>
>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>
>>>                                                          You need to add
>>>                                                          the
>>>                                                          package/classfile
>>> tree
>>>                                                          for you code.
>>>
>>>                                                          As you have:
>>>                                                          java:samplejena
>>>
>>>                                                          Suppoose /DIR is
>>>                                                          the top of that
>>>                                                          directory tree
>>>                                                          so "samplejena"
>>>                                                          is one
>>>                                                          directory within
>>>                                                          /DIR.
>>>
>>>                                                          You then want:
>>>
>>>
>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>
>>>                                                          : is the
>>>                                                          classpath
>>> separator.
>>>
>>>                                                                  Andy
>>>
>>>                                                          On 07/08/18
>>>                                                          16:25, Arunkumar
>>>                                                          Krishnamoorthy
>>>                                                          wrote:
>>>
>>>                                                          Hello,
>>>
>>>                                                              I have
>>>                                                              attached the
>>>                                                              file with
>>>                                                              the change,
>>>                                                              i am getting
>>>                                                              Could
>>>                                                              not find
>>>                                                              or
>>>                                                              load main
>>>                                                              class arq.arq
>>>
>>>                                                              My classpath
>>>                                                              location is
>>>
>>> /home/ak/Documents.
>>>                                                              Please let
>>>                                                              me know
>>>                                                              whether
>>>                                                              my change is
>>>                                                              correct.
>>>
>>>                                                              Regards,
>>>                                                              Arun
>>>
>>>
>>>                                                              On Tue, Aug
>>>                                                              7, 2018 at
>>>                                                              11:11 AM,
>>>                                                              Andy Seaborne
>>> <
>>>
>>>                  andy@apache.org <ma...@apache.org>
>>>
>>>                                                              <mailto:
>>>
>>> andy@apache.org
>>>                                                              <mailto:
>>> andy@apache.org>>>
>>>                                                              wrote:
>>>
>>>                                                                      Hi -
>>>                                                              Please send
>>>                                                              email to the
>>>                                                              jena users
>>>                                                              mailing list.
>>>
>>>                                                                      (It
>>>                                                              is correct
>>>                                                              if it works!)
>>>
>>>
>>>                                                            Andy
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
> 

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
So i need to change this function to dateTime?,

NodeValue date = NodeValue.makeDate(lastModified);

is "make date"

On Fri, Aug 10, 2018 at 9:51 AM, Andy Seaborne <an...@apache.org> wrote:

>
>
> On 10/08/18 14:36, Arunkumar Krishnamoorthy wrote:
>
>> Even i don't know where that particular date is coming from. The dataset
>> is attached.
>>
>
> if it is not in the data and not in query, then it is in your code.
>
> What about URLConnection.getLastModifed?
>
> NB: You are in timezone +05:00 judging by ncsu.edu.
>
> 1969-12-31T19:00:00 +05:00
>
> is
>
> 1970-01-01T00:00:00
>
> which 0 in Unix time.
>
> >> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
> Isn't a date, it's dateTime format.
>
> >>
> NodeValue date = NodeValue.makeDate(lastModified);
>
> is "make date"
>
>     Andy
>
>
>>
>> On Fri, Aug 10, 2018 at 3:57 AM, Andy Seaborne <andy@apache.org <mailto:
>> andy@apache.org>> wrote:
>>
>>     >> But i have given the type as xsd:dateTime, so it should take it
>> right?
>>
>>     The computer says otherwise.
>>
>>     >>myfn:LastModified(?r) >
>>     >> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>
>>       "2005-11-06T00:00:00Z"^^xsd:dateTime  is OK
>>
>>     >> "1969-12-31T19:00:00"^^xsd:date
>>
>>     Not OK. Find out where "1969-12-31T19:00:00" comes from. Is it in
>>     the data?
>>
>>          Andy
>>
>>
>>
>>
>>     On 10/08/18 06:53, Lorenz Buehmann wrote:
>>
>>         which type? in the function or in the data? both have to match,
>>         there is
>>         no implicit conversion I guess.
>>
>>
>>         On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
>>
>>             But i have given the type as xsd:dateTime, so it should take
>>             it right?
>>
>>             On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <ajs6f@apache.org
>>             <ma...@apache.org>> wrote:
>>
>>                     13:44:11 WARN  NodeValue            :: Datatype
>>                     format exception:
>>                     "1969-12-31T19:00:00"^^xsd:date
>>
>>                 No, Jena is just telling you (quite correctly) that
>>                 "1969-12-31T19:00:00"
>>                 is not an xsd:date. Notice the time that is included.
>>                 xsd:date does not
>>                 include time.
>>
>>                 ajs6f
>>
>>                     On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy
>>                     <akrish12@ncsu.edu <ma...@ncsu.edu>>
>>
>>                 wrote:
>>
>>                     Hello Andy,
>>
>>                     I am getting the below error when i run the query
>>                     against the dataset
>>                     shared with you,
>>
>>                     PREFIX myfn: <java:samplejena.>
>>                     PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#
>>                     <http://www.w3.org/2000/01/rdf-schema#>>
>>                     PREFIX dc: <http://purl.org/dc/elements/1.1/
>>                     <http://purl.org/dc/elements/1.1/>>
>>                     PREFIX xsd: <http://www.w3.org/2001/XMLSchema#
>>                     <http://www.w3.org/2001/XMLSchema#>>
>>                     SELECT ?title ?r
>>                     WHERE {
>>                     ?s rdfs:seeAlso ?r.
>>                     OPTIONAL {?r dc:title ?title.}
>>                     FILTER ( isURI(?r) &&
>>                     myfn:LastModified(?r) >
>>                     "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>                     }
>>
>>                     13:44:11 WARN  NodeValue            :: Datatype
>>                     format exception:
>>                     "1969-12-31T19:00:00"^^xsd:date
>>
>>                     Is this because of any old version or something?
>>
>>
>>
>>                     On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne
>>                     <andy@apache.org <ma...@apache.org>> wrote:
>>
>>                         Good question - there is still a noticeable tail
>>                         of com.hp.hpl, here and
>>                         on Stackoverflow.
>>
>>                         Some is due to old apps; that is good in that
>>                         the software is useful
>>                         enough to be used for such a long time.
>>
>>                         I suspect that some of the rest is university
>>                         courses providing the
>>                         materials that have not been updated.
>>
>>                         (Jena3 was 2015-07-29)
>>
>>                              Andy
>>
>>
>>                         On 09/08/18 06:48, Lorenz Buehmann wrote:
>>
>>                             I'm always wondering how people that are new
>>                             to Apache Jena still use
>>                             the old version. I mean, the first hit via
>>                             Google is the Apache Jena
>>                             webpage which clearly refers to the latest
>>                             version.
>>
>>                             In the current case, he just copied the code
>>                             example from [1] which
>>                             indeed uses the old version given that the
>>                             blog entry is from 2005.
>>                             Well, at this time I didn't know about
>>                             Semantic Web at all...
>>
>>                             [1]
>>                             http://www.ldodds.com/projects
>> /sparql/LastModified.txt
>>                             <http://www.ldodds.com/project
>> s/sparql/LastModified.txt>
>>
>>
>>                             On 08.08.2018 22:14, Andy Seaborne wrote:
>>
>>                                 com.hp.hpl.jena -- that's Jena2.
>>
>>                                 Packages are "org.apache.jena" in Jena3.
>>
>>                                 The code seems to have been compiled
>>                                 against Jena2 and run against
>>                                 Jena3.  That won't work.
>>
>>                                       Andy
>>
>>                                 On 08/08/18 18:14, Arunkumar
>>                                 Krishnamoorthy wrote:
>>
>>                                     The java code i am executing is,
>>
>>                                     package samplejena;
>>
>>                                     import
>>                                     com.hp.hpl.jena.query.expr.NodeValue;
>>                                     import
>>                                     com.hp.hpl.jena.query.function
>> .FunctionBase1;
>>
>>                                     import java.net.*;
>>                                     import java.text.SimpleDateFormat;
>>                                     import java.util.*;
>>
>>                                     public class LastModified extends
>>                                     FunctionBase1
>>                                     {
>>                                     private static final
>>                                     SimpleDateFormat format = new
>>                                     SimpleDateFormat("yyyy-MM-dd'T
>> 'HH:mm:ss");
>>                                     private Map _cache;
>>                                     public LastModified()
>>                                     {
>>                                     _cache = new HashMap();
>>                                     }
>>                                     public NodeValue exec(NodeValue
>>                                     nodeValue)
>>                                     {
>>                                     String value = nodeValue.asString();
>>                                     if (_cache.containsKey(value))
>>                                     {
>>                                     return (NodeValue)_cache.get(value);
>>                                     }
>>                                                String lastModified = "";
>>                                     try {
>>                                     lastModified = getLastModified(
>>                                     nodeValue.asString() );
>>                                     } catch (Exception e) {
>>                                     // TODO Auto-generated catch block
>>                                     e.printStackTrace();
>>                                     }
>>
>>                                                NodeValue date =
>>                                     NodeValue.makeDate(lastModified);
>>                                                _cache.put(value, date);
>>                                                return date;
>>                                     }
>>                                     public String getLastModified(String
>>                                     link) throws Exception
>>                                     {
>>                                     URL url = new URL(link);
>>                                     URLConnection connection =
>>                                     url.openConnection();
>>                                     connection.setAllowUserInterac
>> tion(false);
>>                                     long secs =
>>                                     connection.getLastModified();
>>                                     String xsdDate = dateToXSD(secs);
>>                                     return xsdDate;
>>                                     }
>>                                     public String dateToXSD(long secs)
>>                                     {
>>                                     Date date = new Date(secs);
>>                                     return format.format(date);
>>                                     }
>>                                     }
>>
>>
>>
>>                                     On Wed, Aug 8, 2018 at 1:14 PM,
>>                                     Arunkumar Krishnamoorthy
>>                                     <akrish12@ncsu.edu
>>                                     <ma...@ncsu.edu>>
>>                                     wrote:
>>
>>                                     Hello Andy,
>>
>>                                         I am getting the following issue
>>                                         when i run the code,
>>
>>                                         Caused by:
>>                                         java.lang.ClassNotFoundException:
>> com.hp.hpl.jena.query.
>>                                         function.FunctionBase1
>>                                         at
>>                                         java.net.URLClassLoader.findCl
>> ass(URLClassLoader.java:381)
>>                                         at
>>                                         java.lang.ClassLoader.loadClas
>> s(ClassLoader.java:424)
>>                                         at
>>                                         sun.misc.Launcher$AppClassLoad
>> er.loadClass(Launcher.j
>>
>>                                         I have added the .class file in
>>                                         the directory. Do i need to
>> package
>>
>>                 the
>>
>>                                         dependancy jars also? Please
>> advice.
>>
>>                                         Regards,
>>                                         Arun
>>
>>                                         On Tue, Aug 7, 2018 at 2:11 PM,
>>                                         Arunkumar Krishnamoorthy <
>>                                         akrish12@ncsu.edu
>>                                         <ma...@ncsu.edu>>
>> wrote:
>>
>>                                         It is executing now Andy. Thanks
>>                                         a lot. I missed to add the
>>
>>                 directory.
>>
>>                                             Thanks again for this help.
>>
>>                                             On Tue, Aug 7, 2018 at 2:06
>>                                             PM, Andy Seaborne
>>                                             <andy@apache.org
>>                                             <ma...@apache.org>>
>>
>>                                             wrote:
>>
>>
>>                                                 On 07/08/18 18:07,
>>                                                 Arunkumar Krishnamoorthy
>>                                                 wrote:
>>
>>                                                 So my JENA_CP
>>
>>                                                     is
>>
>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>                                                     /Documents'.
>>
>>
>>                                                 Does the file
>>
>>
>> /home/ak/Documents/samplejena/LastModified.class
>>
>>                                                 exist?
>>
>>
>>
>>                                                 /home/ak/Documents
>>                                                 location has the
>>                                                 classfile/jar of the code
>>
>>                                                     But still when i run
>>                                                     this command,
>>
>>
>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>                                                     --data
>>
>> /home/ak/Desktop/dataset.rdf
>>                                                     --query
>>
>> /home/ak/Desktop/query.rq
>>
>>                                                     I am getting the
>>                                                     below error,
>>
>>                                                     ak@akrish12:~$
>>
>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>
>>                 --data
>>
>>
>> /home/ak/Desktop/dataset.rdf
>>                                                     --query
>>
>> /home/ak/Desktop/query.rq
>>                                                     12:41:35 WARN
>>                                              ClsLoader
>>                                          :: Class not found:
>>
>> samplejena.LastModified
>>                                                     12:41:35 WARN  exec
>>                                                                    :: URI
>>
>> <java:samplejena.LastModified>
>>                                                     has no registered
>>                                                     function factory
>>                                                     -------------
>>                                                     | title | r |
>>                                                     =============
>>                                                     -------------
>>
>>
>>                                                     Regards,
>>                                                     Arun
>>
>>                                                     On Tue, Aug 7, 2018
>>                                                     at 12:20 PM, Andy
>>                                                     Seaborne
>>                                                     <andy@apache.org
>>                                                     <mailto:
>> andy@apache.org>>
>>
>>                                                     wrote:
>>
>>                                                     The list doesn't
>>                                                     accept attachments.
>>
>>
>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>
>>                                                             This needs
>>                                                             to be a
>>                                                             valid java
>>                                                             classpath.
>>
>>                                                         $JENA_HOME is
>>                                                         directory of the
>>                                                         Jena installation.
>>
>>                                                         In the original
>>                                                         it says:
>>
>>
>> JENA_CP="$JENA_HOME"'/lib/*'
>>
>>                                                         the .../lib/*
>>                                                         (NB single
>>                                                         quotes - no *
>>                                                         expansion) puts
>>                                                         all the
>>                                                         jars in
>>                                                         that direct on
>>                                                         the classpath.
>>
>>                                                         For you:
>>
>>
>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>
>>                                                         You need to add
>>                                                         the
>>                                                         package/classfile
>> tree
>>                                                         for you code.
>>
>>                                                         As you have:
>>                                                         java:samplejena
>>
>>                                                         Suppoose /DIR is
>>                                                         the top of that
>>                                                         directory tree
>>                                                         so "samplejena"
>>                                                         is one
>>                                                         directory within
>>                                                         /DIR.
>>
>>                                                         You then want:
>>
>>
>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>
>>                                                         : is the
>>                                                         classpath
>> separator.
>>
>>                                                                 Andy
>>
>>                                                         On 07/08/18
>>                                                         16:25, Arunkumar
>>                                                         Krishnamoorthy
>>                                                         wrote:
>>
>>                                                         Hello,
>>
>>                                                             I have
>>                                                             attached the
>>                                                             file with
>>                                                             the change,
>>                                                             i am getting
>>                                                             Could
>>                                                             not find
>>                                                             or
>>                                                             load main
>>                                                             class arq.arq
>>
>>                                                             My classpath
>>                                                             location is
>>
>> /home/ak/Documents.
>>                                                             Please let
>>                                                             me know
>>                                                             whether
>>                                                             my change is
>>                                                             correct.
>>
>>                                                             Regards,
>>                                                             Arun
>>
>>
>>                                                             On Tue, Aug
>>                                                             7, 2018 at
>>                                                             11:11 AM,
>>                                                             Andy Seaborne
>> <
>>
>>                 andy@apache.org <ma...@apache.org>
>>
>>                                                             <mailto:
>>
>> andy@apache.org
>>                                                             <mailto:
>> andy@apache.org>>>
>>                                                             wrote:
>>
>>                                                                     Hi -
>>                                                             Please send
>>                                                             email to the
>>                                                             jena users
>>                                                             mailing list.
>>
>>                                                                     (It
>>                                                             is correct
>>                                                             if it works!)
>>
>>
>>                                                           Andy
>>
>>
>>
>>
>>
>>
>>
>>
>>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.

On 10/08/18 14:36, Arunkumar Krishnamoorthy wrote:
> Even i don't know where that particular date is coming from. The dataset 
> is attached.

if it is not in the data and not in query, then it is in your code.

What about URLConnection.getLastModifed?

NB: You are in timezone +05:00 judging by ncsu.edu.

1969-12-31T19:00:00 +05:00

is

1970-01-01T00:00:00

which 0 in Unix time.

 >> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Isn't a date, it's dateTime format.

 >>
NodeValue date = NodeValue.makeDate(lastModified);

is "make date"

     Andy

> 
> 
> On Fri, Aug 10, 2018 at 3:57 AM, Andy Seaborne <andy@apache.org 
> <ma...@apache.org>> wrote:
> 
>     >> But i have given the type as xsd:dateTime, so it should take it right?
> 
>     The computer says otherwise.
> 
>     >>myfn:LastModified(?r) >
>     >> "2005-11-06T00:00:00Z"^^xsd:dateTime )
> 
>       "2005-11-06T00:00:00Z"^^xsd:dateTime  is OK
> 
>     >> "1969-12-31T19:00:00"^^xsd:date
> 
>     Not OK. Find out where "1969-12-31T19:00:00" comes from. Is it in
>     the data?
> 
>          Andy
> 
> 
> 
> 
>     On 10/08/18 06:53, Lorenz Buehmann wrote:
> 
>         which type? in the function or in the data? both have to match,
>         there is
>         no implicit conversion I guess.
> 
> 
>         On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
> 
>             But i have given the type as xsd:dateTime, so it should take
>             it right?
> 
>             On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <ajs6f@apache.org
>             <ma...@apache.org>> wrote:
> 
>                     13:44:11 WARN  NodeValue            :: Datatype
>                     format exception:
>                     "1969-12-31T19:00:00"^^xsd:date
> 
>                 No, Jena is just telling you (quite correctly) that
>                 "1969-12-31T19:00:00"
>                 is not an xsd:date. Notice the time that is included.
>                 xsd:date does not
>                 include time.
> 
>                 ajs6f
> 
>                     On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy
>                     <akrish12@ncsu.edu <ma...@ncsu.edu>>
> 
>                 wrote:
> 
>                     Hello Andy,
> 
>                     I am getting the below error when i run the query
>                     against the dataset
>                     shared with you,
> 
>                     PREFIX myfn: <java:samplejena.>
>                     PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#
>                     <http://www.w3.org/2000/01/rdf-schema#>>
>                     PREFIX dc: <http://purl.org/dc/elements/1.1/
>                     <http://purl.org/dc/elements/1.1/>>
>                     PREFIX xsd: <http://www.w3.org/2001/XMLSchema#
>                     <http://www.w3.org/2001/XMLSchema#>>
>                     SELECT ?title ?r
>                     WHERE {
>                     ?s rdfs:seeAlso ?r.
>                     OPTIONAL {?r dc:title ?title.}
>                     FILTER ( isURI(?r) &&
>                     myfn:LastModified(?r) >
>                     "2005-11-06T00:00:00Z"^^xsd:dateTime )
>                     }
> 
>                     13:44:11 WARN  NodeValue            :: Datatype
>                     format exception:
>                     "1969-12-31T19:00:00"^^xsd:date
> 
>                     Is this because of any old version or something?
> 
> 
> 
>                     On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne
>                     <andy@apache.org <ma...@apache.org>> wrote:
> 
>                         Good question - there is still a noticeable tail
>                         of com.hp.hpl, here and
>                         on Stackoverflow.
> 
>                         Some is due to old apps; that is good in that
>                         the software is useful
>                         enough to be used for such a long time.
> 
>                         I suspect that some of the rest is university
>                         courses providing the
>                         materials that have not been updated.
> 
>                         (Jena3 was 2015-07-29)
> 
>                              Andy
> 
> 
>                         On 09/08/18 06:48, Lorenz Buehmann wrote:
> 
>                             I'm always wondering how people that are new
>                             to Apache Jena still use
>                             the old version. I mean, the first hit via
>                             Google is the Apache Jena
>                             webpage which clearly refers to the latest
>                             version.
> 
>                             In the current case, he just copied the code
>                             example from [1] which
>                             indeed uses the old version given that the
>                             blog entry is from 2005.
>                             Well, at this time I didn't know about
>                             Semantic Web at all...
> 
>                             [1]
>                             http://www.ldodds.com/projects/sparql/LastModified.txt
>                             <http://www.ldodds.com/projects/sparql/LastModified.txt>
> 
> 
>                             On 08.08.2018 22:14, Andy Seaborne wrote:
> 
>                                 com.hp.hpl.jena -- that's Jena2.
> 
>                                 Packages are "org.apache.jena" in Jena3.
> 
>                                 The code seems to have been compiled
>                                 against Jena2 and run against
>                                 Jena3.  That won't work.
> 
>                                       Andy
> 
>                                 On 08/08/18 18:14, Arunkumar
>                                 Krishnamoorthy wrote:
> 
>                                     The java code i am executing is,
> 
>                                     package samplejena;
> 
>                                     import
>                                     com.hp.hpl.jena.query.expr.NodeValue;
>                                     import
>                                     com.hp.hpl.jena.query.function.FunctionBase1;
> 
>                                     import java.net.*;
>                                     import java.text.SimpleDateFormat;
>                                     import java.util.*;
> 
>                                     public class LastModified extends
>                                     FunctionBase1
>                                     {
>                                     private static final
>                                     SimpleDateFormat format = new
>                                     SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>                                     private Map _cache;
>                                     public LastModified()
>                                     {
>                                     _cache = new HashMap();
>                                     }
>                                     public NodeValue exec(NodeValue
>                                     nodeValue)
>                                     {
>                                     String value = nodeValue.asString();
>                                     if (_cache.containsKey(value))
>                                     {
>                                     return (NodeValue)_cache.get(value);
>                                     }
>                                                String lastModified = "";
>                                     try {
>                                     lastModified = getLastModified(
>                                     nodeValue.asString() );
>                                     } catch (Exception e) {
>                                     // TODO Auto-generated catch block
>                                     e.printStackTrace();
>                                     }
> 
>                                                NodeValue date =
>                                     NodeValue.makeDate(lastModified);
>                                                _cache.put(value, date);
>                                                return date;
>                                     }
>                                     public String getLastModified(String
>                                     link) throws Exception
>                                     {
>                                     URL url = new URL(link);
>                                     URLConnection connection =
>                                     url.openConnection();
>                                     connection.setAllowUserInteraction(false);
>                                     long secs =
>                                     connection.getLastModified();
>                                     String xsdDate = dateToXSD(secs);
>                                     return xsdDate;
>                                     }
>                                     public String dateToXSD(long secs)
>                                     {
>                                     Date date = new Date(secs);
>                                     return format.format(date);
>                                     }
>                                     }
> 
> 
> 
>                                     On Wed, Aug 8, 2018 at 1:14 PM,
>                                     Arunkumar Krishnamoorthy
>                                     <akrish12@ncsu.edu
>                                     <ma...@ncsu.edu>>
>                                     wrote:
> 
>                                     Hello Andy,
> 
>                                         I am getting the following issue
>                                         when i run the code,
> 
>                                         Caused by:
>                                         java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>                                         function.FunctionBase1
>                                         at
>                                         java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>                                         at
>                                         java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>                                         at
>                                         sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
> 
>                                         I have added the .class file in
>                                         the directory. Do i need to package
> 
>                 the
> 
>                                         dependancy jars also? Please advice.
> 
>                                         Regards,
>                                         Arun
> 
>                                         On Tue, Aug 7, 2018 at 2:11 PM,
>                                         Arunkumar Krishnamoorthy <
>                                         akrish12@ncsu.edu
>                                         <ma...@ncsu.edu>> wrote:
> 
>                                         It is executing now Andy. Thanks
>                                         a lot. I missed to add the
> 
>                 directory.
> 
>                                             Thanks again for this help.
> 
>                                             On Tue, Aug 7, 2018 at 2:06
>                                             PM, Andy Seaborne
>                                             <andy@apache.org
>                                             <ma...@apache.org>>
>                                             wrote:
> 
> 
>                                                 On 07/08/18 18:07,
>                                                 Arunkumar Krishnamoorthy
>                                                 wrote:
> 
>                                                 So my JENA_CP
> 
>                                                     is
>                                                     JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>                                                     /Documents'.
> 
> 
>                                                 Does the file
> 
>                                                 /home/ak/Documents/samplejena/LastModified.class
> 
>                                                 exist?
> 
> 
> 
>                                                 /home/ak/Documents
>                                                 location has the
>                                                 classfile/jar of the code
> 
>                                                     But still when i run
>                                                     this command,
> 
>                                                     /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>                                                     --data
>                                                     /home/ak/Desktop/dataset.rdf
>                                                     --query
>                                                     /home/ak/Desktop/query.rq
> 
>                                                     I am getting the
>                                                     below error,
> 
>                                                     ak@akrish12:~$
>                                                     /home/ak/Downloads/apache-jena-3.8.0/bin/arq
> 
>                 --data
> 
>                                                     /home/ak/Desktop/dataset.rdf
>                                                     --query
>                                                     /home/ak/Desktop/query.rq
>                                                     12:41:35 WARN 
>                                                     ClsLoader           
>                                                     :: Class not found:
>                                                     samplejena.LastModified
>                                                     12:41:35 WARN  exec 
>                                                                     :: URI
>                                                     <java:samplejena.LastModified>
>                                                     has no registered
>                                                     function factory
>                                                     -------------
>                                                     | title | r |
>                                                     =============
>                                                     -------------
> 
> 
>                                                     Regards,
>                                                     Arun
> 
>                                                     On Tue, Aug 7, 2018
>                                                     at 12:20 PM, Andy
>                                                     Seaborne
>                                                     <andy@apache.org
>                                                     <ma...@apache.org>>
>                                                     wrote:
> 
>                                                     The list doesn't
>                                                     accept attachments.
> 
>                                                         JENA_CP="$JENA_HOME"'/home/ak/Documents'
> 
>                                                             This needs
>                                                             to be a
>                                                             valid java
>                                                             classpath.
> 
>                                                         $JENA_HOME is
>                                                         directory of the
>                                                         Jena installation.
> 
>                                                         In the original
>                                                         it says:
> 
>                                                         JENA_CP="$JENA_HOME"'/lib/*'
> 
>                                                         the .../lib/*
>                                                         (NB single
>                                                         quotes - no *
>                                                         expansion) puts
>                                                         all the
>                                                         jars in
>                                                         that direct on
>                                                         the classpath.
> 
>                                                         For you:
> 
>                                                         JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
> 
>                                                         You need to add
>                                                         the
>                                                         package/classfile tree
>                                                         for you code.
> 
>                                                         As you have:
>                                                         java:samplejena
> 
>                                                         Suppoose /DIR is
>                                                         the top of that
>                                                         directory tree
>                                                         so "samplejena"
>                                                         is one
>                                                         directory within
>                                                         /DIR.
> 
>                                                         You then want:
> 
>                                                         JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
> 
>                                                         : is the
>                                                         classpath separator.
> 
>                                                                 Andy
> 
>                                                         On 07/08/18
>                                                         16:25, Arunkumar
>                                                         Krishnamoorthy
>                                                         wrote:
> 
>                                                         Hello,
> 
>                                                             I have
>                                                             attached the
>                                                             file with
>                                                             the change,
>                                                             i am getting
>                                                             Could
>                                                             not find
>                                                             or
>                                                             load main
>                                                             class arq.arq
> 
>                                                             My classpath
>                                                             location is
>                                                             /home/ak/Documents.
>                                                             Please let
>                                                             me know
>                                                             whether
>                                                             my change is
>                                                             correct.
> 
>                                                             Regards,
>                                                             Arun
> 
> 
>                                                             On Tue, Aug
>                                                             7, 2018 at
>                                                             11:11 AM,
>                                                             Andy Seaborne <
> 
>                 andy@apache.org <ma...@apache.org>
> 
>                                                             <mailto:
>                                                             andy@apache.org
>                                                             <ma...@apache.org>>>
>                                                             wrote:
> 
>                                                                     Hi -
>                                                             Please send
>                                                             email to the
>                                                             jena users
>                                                             mailing list.
> 
>                                                                     (It
>                                                             is correct
>                                                             if it works!)
> 
>                                                                         
>                                                             Andy
> 
> 
> 
> 
> 
> 
> 
> 

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
Even i don't know where that particular date is coming from. The dataset is
attached.


On Fri, Aug 10, 2018 at 3:57 AM, Andy Seaborne <an...@apache.org> wrote:

> >> But i have given the type as xsd:dateTime, so it should take it right?
>
> The computer says otherwise.
>
> >>myfn:LastModified(?r) >
> >> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>
>  "2005-11-06T00:00:00Z"^^xsd:dateTime  is OK
>
> >> "1969-12-31T19:00:00"^^xsd:date
>
> Not OK. Find out where "1969-12-31T19:00:00" comes from. Is it in the data?
>
>     Andy
>
>
>
>
> On 10/08/18 06:53, Lorenz Buehmann wrote:
>
>> which type? in the function or in the data? both have to match, there is
>> no implicit conversion I guess.
>>
>>
>> On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
>>
>>> But i have given the type as xsd:dateTime, so it should take it right?
>>>
>>> On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <aj...@apache.org> wrote:
>>>
>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>>>> "1969-12-31T19:00:00"^^xsd:date
>>>>>
>>>> No, Jena is just telling you (quite correctly) that
>>>> "1969-12-31T19:00:00"
>>>> is not an xsd:date. Notice the time that is included. xsd:date does not
>>>> include time.
>>>>
>>>> ajs6f
>>>>
>>>> On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy <akrish12@ncsu.edu
>>>>> >
>>>>>
>>>> wrote:
>>>>
>>>>> Hello Andy,
>>>>>
>>>>> I am getting the below error when i run the query against the dataset
>>>>> shared with you,
>>>>>
>>>>> PREFIX myfn: <java:samplejena.>
>>>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>>>> PREFIX dc: <http://purl.org/dc/elements/1.1/>
>>>>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>>>>> SELECT ?title ?r
>>>>> WHERE {
>>>>> ?s rdfs:seeAlso ?r.
>>>>> OPTIONAL {?r dc:title ?title.}
>>>>> FILTER ( isURI(?r) &&
>>>>> myfn:LastModified(?r) >
>>>>> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>>>> }
>>>>>
>>>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>>>> "1969-12-31T19:00:00"^^xsd:date
>>>>>
>>>>> Is this because of any old version or something?
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:
>>>>>
>>>>> Good question - there is still a noticeable tail of com.hp.hpl, here
>>>>>> and
>>>>>> on Stackoverflow.
>>>>>>
>>>>>> Some is due to old apps; that is good in that the software is useful
>>>>>> enough to be used for such a long time.
>>>>>>
>>>>>> I suspect that some of the rest is university courses providing the
>>>>>> materials that have not been updated.
>>>>>>
>>>>>> (Jena3 was 2015-07-29)
>>>>>>
>>>>>>     Andy
>>>>>>
>>>>>>
>>>>>> On 09/08/18 06:48, Lorenz Buehmann wrote:
>>>>>>
>>>>>> I'm always wondering how people that are new to Apache Jena still use
>>>>>>> the old version. I mean, the first hit via Google is the Apache Jena
>>>>>>> webpage which clearly refers to the latest version.
>>>>>>>
>>>>>>> In the current case, he just copied the code example from [1] which
>>>>>>> indeed uses the old version given that the blog entry is from 2005.
>>>>>>> Well, at this time I didn't know about Semantic Web at all...
>>>>>>>
>>>>>>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
>>>>>>>
>>>>>>>
>>>>>>> On 08.08.2018 22:14, Andy Seaborne wrote:
>>>>>>>
>>>>>>> com.hp.hpl.jena -- that's Jena2.
>>>>>>>>
>>>>>>>> Packages are "org.apache.jena" in Jena3.
>>>>>>>>
>>>>>>>> The code seems to have been compiled against Jena2 and run against
>>>>>>>> Jena3.  That won't work.
>>>>>>>>
>>>>>>>>      Andy
>>>>>>>>
>>>>>>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>>>>>>>
>>>>>>>> The java code i am executing is,
>>>>>>>>>
>>>>>>>>> package samplejena;
>>>>>>>>>
>>>>>>>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>>>>>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>>>>>>>
>>>>>>>>> import java.net.*;
>>>>>>>>> import java.text.SimpleDateFormat;
>>>>>>>>> import java.util.*;
>>>>>>>>>
>>>>>>>>> public class LastModified extends FunctionBase1
>>>>>>>>> {
>>>>>>>>> private static final SimpleDateFormat format = new
>>>>>>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>>>>>>>> private Map _cache;
>>>>>>>>> public LastModified()
>>>>>>>>> {
>>>>>>>>> _cache = new HashMap();
>>>>>>>>> }
>>>>>>>>> public NodeValue exec(NodeValue nodeValue)
>>>>>>>>> {
>>>>>>>>> String value = nodeValue.asString();
>>>>>>>>> if (_cache.containsKey(value))
>>>>>>>>> {
>>>>>>>>> return (NodeValue)_cache.get(value);
>>>>>>>>> }
>>>>>>>>>           String lastModified = "";
>>>>>>>>> try {
>>>>>>>>> lastModified = getLastModified( nodeValue.asString() );
>>>>>>>>> } catch (Exception e) {
>>>>>>>>> // TODO Auto-generated catch block
>>>>>>>>> e.printStackTrace();
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>           NodeValue date = NodeValue.makeDate(lastModified);
>>>>>>>>>           _cache.put(value, date);
>>>>>>>>>           return date;
>>>>>>>>> }
>>>>>>>>> public String getLastModified(String link) throws Exception
>>>>>>>>> {
>>>>>>>>> URL url = new URL(link);
>>>>>>>>> URLConnection connection = url.openConnection();
>>>>>>>>> connection.setAllowUserInteraction(false);
>>>>>>>>> long secs = connection.getLastModified();
>>>>>>>>> String xsdDate = dateToXSD(secs);
>>>>>>>>> return xsdDate;
>>>>>>>>> }
>>>>>>>>> public String dateToXSD(long secs)
>>>>>>>>> {
>>>>>>>>> Date date = new Date(secs);
>>>>>>>>> return format.format(date);
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>>>>>>>> <ak...@ncsu.edu>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hello Andy,
>>>>>>>>>
>>>>>>>>>> I am getting the following issue when i run the code,
>>>>>>>>>>
>>>>>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>>>>>> com.hp.hpl.jena.query.
>>>>>>>>>> function.FunctionBase1
>>>>>>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>>>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>>>>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>>>>>>>
>>>>>>>>>> I have added the .class file in the directory. Do i need to
>>>>>>>>>> package
>>>>>>>>>>
>>>>>>>>> the
>>>>
>>>>> dependancy jars also? Please advice.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Arun
>>>>>>>>>>
>>>>>>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>>>>>>>> akrish12@ncsu.edu> wrote:
>>>>>>>>>>
>>>>>>>>>> It is executing now Andy. Thanks a lot. I missed to add the
>>>>>>>>>>
>>>>>>>>> directory.
>>>>
>>>>> Thanks again for this help.
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> So my JENA_CP
>>>>>>>>>>>>
>>>>>>>>>>>>> is JENA_CP='/home/ak/Downloads/ap
>>>>>>>>>>>>> ache-jena-3.8.0/lib/*:/home/ak
>>>>>>>>>>>>> /Documents'.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Does the file
>>>>>>>>>>>>
>>>>>>>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>>>>>>>
>>>>>>>>>>>> exist?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>>>>>>
>>>>>>>>>>>>> But still when i run this command,
>>>>>>>>>>>>>
>>>>>>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am getting the below error,
>>>>>>>>>>>>>
>>>>>>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>>>>>>>>>>>>
>>>>>>>>>>>> --data
>>>>
>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>>>>>>>> samplejena.LastModified
>>>>>>>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>>>>>>>> <java:samplejena.LastModified>
>>>>>>>>>>>>> has no registered function factory
>>>>>>>>>>>>> -------------
>>>>>>>>>>>>> | title | r |
>>>>>>>>>>>>> =============
>>>>>>>>>>>>> -------------
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> Arun
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <
>>>>>>>>>>>>> andy@apache.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> The list doesn't accept attachments.
>>>>>>>>>>>>>
>>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> In the original it says:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>>>>>>>> jars in
>>>>>>>>>>>>>> that direct on the classpath.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> For you:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> As you have: java:samplejena
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Suppoose /DIR is the top of that directory tree so
>>>>>>>>>>>>>> "samplejena"
>>>>>>>>>>>>>> is one
>>>>>>>>>>>>>> directory within /DIR.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> You then want:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> : is the classpath separator.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>        Andy
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>>>>>>>> not find
>>>>>>>>>>>>>>> or
>>>>>>>>>>>>>>> load main class arq.arq
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me
>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>> whether
>>>>>>>>>>>>>>> my change is correct.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>> Arun
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> andy@apache.org
>>>>
>>>>> <mailto:
>>>>>>>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>        Hi - Please send email to the jena users mailing list.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>        (It is correct if it works!)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>             Andy
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>
>>>>
>>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.
 >> But i have given the type as xsd:dateTime, so it should take it right?

The computer says otherwise.

 >>myfn:LastModified(?r) >
 >> "2005-11-06T00:00:00Z"^^xsd:dateTime )

  "2005-11-06T00:00:00Z"^^xsd:dateTime  is OK

 >> "1969-12-31T19:00:00"^^xsd:date

Not OK. Find out where "1969-12-31T19:00:00" comes from. Is it in the data?

     Andy



On 10/08/18 06:53, Lorenz Buehmann wrote:
> which type? in the function or in the data? both have to match, there is
> no implicit conversion I guess.
> 
> 
> On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
>> But i have given the type as xsd:dateTime, so it should take it right?
>>
>> On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <aj...@apache.org> wrote:
>>
>>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>>> "1969-12-31T19:00:00"^^xsd:date
>>> No, Jena is just telling you (quite correctly) that "1969-12-31T19:00:00"
>>> is not an xsd:date. Notice the time that is included. xsd:date does not
>>> include time.
>>>
>>> ajs6f
>>>
>>>> On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
>>> wrote:
>>>> Hello Andy,
>>>>
>>>> I am getting the below error when i run the query against the dataset
>>>> shared with you,
>>>>
>>>> PREFIX myfn: <java:samplejena.>
>>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>>> PREFIX dc: <http://purl.org/dc/elements/1.1/>
>>>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>>>> SELECT ?title ?r
>>>> WHERE {
>>>> ?s rdfs:seeAlso ?r.
>>>> OPTIONAL {?r dc:title ?title.}
>>>> FILTER ( isURI(?r) &&
>>>> myfn:LastModified(?r) >
>>>> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>>> }
>>>>
>>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>>> "1969-12-31T19:00:00"^^xsd:date
>>>>
>>>> Is this because of any old version or something?
>>>>
>>>>
>>>>
>>>> On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>>> Good question - there is still a noticeable tail of com.hp.hpl, here and
>>>>> on Stackoverflow.
>>>>>
>>>>> Some is due to old apps; that is good in that the software is useful
>>>>> enough to be used for such a long time.
>>>>>
>>>>> I suspect that some of the rest is university courses providing the
>>>>> materials that have not been updated.
>>>>>
>>>>> (Jena3 was 2015-07-29)
>>>>>
>>>>>     Andy
>>>>>
>>>>>
>>>>> On 09/08/18 06:48, Lorenz Buehmann wrote:
>>>>>
>>>>>> I'm always wondering how people that are new to Apache Jena still use
>>>>>> the old version. I mean, the first hit via Google is the Apache Jena
>>>>>> webpage which clearly refers to the latest version.
>>>>>>
>>>>>> In the current case, he just copied the code example from [1] which
>>>>>> indeed uses the old version given that the blog entry is from 2005.
>>>>>> Well, at this time I didn't know about Semantic Web at all...
>>>>>>
>>>>>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
>>>>>>
>>>>>>
>>>>>> On 08.08.2018 22:14, Andy Seaborne wrote:
>>>>>>
>>>>>>> com.hp.hpl.jena -- that's Jena2.
>>>>>>>
>>>>>>> Packages are "org.apache.jena" in Jena3.
>>>>>>>
>>>>>>> The code seems to have been compiled against Jena2 and run against
>>>>>>> Jena3.  That won't work.
>>>>>>>
>>>>>>>      Andy
>>>>>>>
>>>>>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>>>>>>
>>>>>>>> The java code i am executing is,
>>>>>>>>
>>>>>>>> package samplejena;
>>>>>>>>
>>>>>>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>>>>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>>>>>>
>>>>>>>> import java.net.*;
>>>>>>>> import java.text.SimpleDateFormat;
>>>>>>>> import java.util.*;
>>>>>>>>
>>>>>>>> public class LastModified extends FunctionBase1
>>>>>>>> {
>>>>>>>> private static final SimpleDateFormat format = new
>>>>>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>>>>>>> private Map _cache;
>>>>>>>> public LastModified()
>>>>>>>> {
>>>>>>>> _cache = new HashMap();
>>>>>>>> }
>>>>>>>> public NodeValue exec(NodeValue nodeValue)
>>>>>>>> {
>>>>>>>> String value = nodeValue.asString();
>>>>>>>> if (_cache.containsKey(value))
>>>>>>>> {
>>>>>>>> return (NodeValue)_cache.get(value);
>>>>>>>> }
>>>>>>>>           String lastModified = "";
>>>>>>>> try {
>>>>>>>> lastModified = getLastModified( nodeValue.asString() );
>>>>>>>> } catch (Exception e) {
>>>>>>>> // TODO Auto-generated catch block
>>>>>>>> e.printStackTrace();
>>>>>>>> }
>>>>>>>>
>>>>>>>>           NodeValue date = NodeValue.makeDate(lastModified);
>>>>>>>>           _cache.put(value, date);
>>>>>>>>           return date;
>>>>>>>> }
>>>>>>>> public String getLastModified(String link) throws Exception
>>>>>>>> {
>>>>>>>> URL url = new URL(link);
>>>>>>>> URLConnection connection = url.openConnection();
>>>>>>>> connection.setAllowUserInteraction(false);
>>>>>>>> long secs = connection.getLastModified();
>>>>>>>> String xsdDate = dateToXSD(secs);
>>>>>>>> return xsdDate;
>>>>>>>> }
>>>>>>>> public String dateToXSD(long secs)
>>>>>>>> {
>>>>>>>> Date date = new Date(secs);
>>>>>>>> return format.format(date);
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>>>>>>> <ak...@ncsu.edu>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hello Andy,
>>>>>>>>> I am getting the following issue when i run the code,
>>>>>>>>>
>>>>>>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>>>>>>>> function.FunctionBase1
>>>>>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>>>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>>>>>>
>>>>>>>>> I have added the .class file in the directory. Do i need to package
>>> the
>>>>>>>>> dependancy jars also? Please advice.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Arun
>>>>>>>>>
>>>>>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>>>>>>> akrish12@ncsu.edu> wrote:
>>>>>>>>>
>>>>>>>>> It is executing now Andy. Thanks a lot. I missed to add the
>>> directory.
>>>>>>>>>> Thanks again for this help.
>>>>>>>>>>
>>>>>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>>
>>>>>>>>>>> So my JENA_CP
>>>>>>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>>>>>>>> /Documents'.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> Does the file
>>>>>>>>>>>
>>>>>>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>>>>>>
>>>>>>>>>>> exist?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>>>>>> But still when i run this command,
>>>>>>>>>>>>
>>>>>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>>>
>>>>>>>>>>>> I am getting the below error,
>>>>>>>>>>>>
>>>>>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>>> --data
>>>>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>>>>>>> samplejena.LastModified
>>>>>>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>>>>>>> <java:samplejena.LastModified>
>>>>>>>>>>>> has no registered function factory
>>>>>>>>>>>> -------------
>>>>>>>>>>>> | title | r |
>>>>>>>>>>>> =============
>>>>>>>>>>>> -------------
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>> Arun
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> The list doesn't accept attachments.
>>>>>>>>>>>>
>>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>>>>>
>>>>>>>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>>>>>>
>>>>>>>>>>>>> In the original it says:
>>>>>>>>>>>>>
>>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>>>>>>
>>>>>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>>>>>>> jars in
>>>>>>>>>>>>> that direct on the classpath.
>>>>>>>>>>>>>
>>>>>>>>>>>>> For you:
>>>>>>>>>>>>>
>>>>>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>>>>>>
>>>>>>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>>>>>>
>>>>>>>>>>>>> As you have: java:samplejena
>>>>>>>>>>>>>
>>>>>>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
>>>>>>>>>>>>> is one
>>>>>>>>>>>>> directory within /DIR.
>>>>>>>>>>>>>
>>>>>>>>>>>>> You then want:
>>>>>>>>>>>>>
>>>>>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>>>>>>
>>>>>>>>>>>>> : is the classpath separator.
>>>>>>>>>>>>>
>>>>>>>>>>>>>        Andy
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>>>>>>> not find
>>>>>>>>>>>>>> or
>>>>>>>>>>>>>> load main class arq.arq
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>>>>>>>> whether
>>>>>>>>>>>>>> my change is correct.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>> Arun
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <
>>> andy@apache.org
>>>>>>>>>>>>>> <mailto:
>>>>>>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>        Hi - Please send email to the jena users mailing list.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>        (It is correct if it works!)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>             Andy
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>
>>>
> 

Re: Writing an ARQ Extension Function

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
which type? in the function or in the data? both have to match, there is
no implicit conversion I guess.


On 09.08.2018 21:29, Arunkumar Krishnamoorthy wrote:
> But i have given the type as xsd:dateTime, so it should take it right?
>
> On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <aj...@apache.org> wrote:
>
>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>> "1969-12-31T19:00:00"^^xsd:date
>> No, Jena is just telling you (quite correctly) that "1969-12-31T19:00:00"
>> is not an xsd:date. Notice the time that is included. xsd:date does not
>> include time.
>>
>> ajs6f
>>
>>> On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
>> wrote:
>>> Hello Andy,
>>>
>>> I am getting the below error when i run the query against the dataset
>>> shared with you,
>>>
>>> PREFIX myfn: <java:samplejena.>
>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>> PREFIX dc: <http://purl.org/dc/elements/1.1/>
>>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>>> SELECT ?title ?r
>>> WHERE {
>>> ?s rdfs:seeAlso ?r.
>>> OPTIONAL {?r dc:title ?title.}
>>> FILTER ( isURI(?r) &&
>>> myfn:LastModified(?r) >
>>> "2005-11-06T00:00:00Z"^^xsd:dateTime )
>>> }
>>>
>>> 13:44:11 WARN  NodeValue            :: Datatype format exception:
>>> "1969-12-31T19:00:00"^^xsd:date
>>>
>>> Is this because of any old version or something?
>>>
>>>
>>>
>>> On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>>> Good question - there is still a noticeable tail of com.hp.hpl, here and
>>>> on Stackoverflow.
>>>>
>>>> Some is due to old apps; that is good in that the software is useful
>>>> enough to be used for such a long time.
>>>>
>>>> I suspect that some of the rest is university courses providing the
>>>> materials that have not been updated.
>>>>
>>>> (Jena3 was 2015-07-29)
>>>>
>>>>    Andy
>>>>
>>>>
>>>> On 09/08/18 06:48, Lorenz Buehmann wrote:
>>>>
>>>>> I'm always wondering how people that are new to Apache Jena still use
>>>>> the old version. I mean, the first hit via Google is the Apache Jena
>>>>> webpage which clearly refers to the latest version.
>>>>>
>>>>> In the current case, he just copied the code example from [1] which
>>>>> indeed uses the old version given that the blog entry is from 2005.
>>>>> Well, at this time I didn't know about Semantic Web at all...
>>>>>
>>>>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
>>>>>
>>>>>
>>>>> On 08.08.2018 22:14, Andy Seaborne wrote:
>>>>>
>>>>>> com.hp.hpl.jena -- that's Jena2.
>>>>>>
>>>>>> Packages are "org.apache.jena" in Jena3.
>>>>>>
>>>>>> The code seems to have been compiled against Jena2 and run against
>>>>>> Jena3.  That won't work.
>>>>>>
>>>>>>     Andy
>>>>>>
>>>>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>>>>>
>>>>>>> The java code i am executing is,
>>>>>>>
>>>>>>> package samplejena;
>>>>>>>
>>>>>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>>>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>>>>>
>>>>>>> import java.net.*;
>>>>>>> import java.text.SimpleDateFormat;
>>>>>>> import java.util.*;
>>>>>>>
>>>>>>> public class LastModified extends FunctionBase1
>>>>>>> {
>>>>>>> private static final SimpleDateFormat format = new
>>>>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>>>>>> private Map _cache;
>>>>>>> public LastModified()
>>>>>>> {
>>>>>>> _cache = new HashMap();
>>>>>>> }
>>>>>>> public NodeValue exec(NodeValue nodeValue)
>>>>>>> {
>>>>>>> String value = nodeValue.asString();
>>>>>>> if (_cache.containsKey(value))
>>>>>>> {
>>>>>>> return (NodeValue)_cache.get(value);
>>>>>>> }
>>>>>>>          String lastModified = "";
>>>>>>> try {
>>>>>>> lastModified = getLastModified( nodeValue.asString() );
>>>>>>> } catch (Exception e) {
>>>>>>> // TODO Auto-generated catch block
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>>
>>>>>>>          NodeValue date = NodeValue.makeDate(lastModified);
>>>>>>>          _cache.put(value, date);
>>>>>>>          return date;
>>>>>>> }
>>>>>>> public String getLastModified(String link) throws Exception
>>>>>>> {
>>>>>>> URL url = new URL(link);
>>>>>>> URLConnection connection = url.openConnection();
>>>>>>> connection.setAllowUserInteraction(false);
>>>>>>> long secs = connection.getLastModified();
>>>>>>> String xsdDate = dateToXSD(secs);
>>>>>>> return xsdDate;
>>>>>>> }
>>>>>>> public String dateToXSD(long secs)
>>>>>>> {
>>>>>>> Date date = new Date(secs);
>>>>>>> return format.format(date);
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>>>>>> <ak...@ncsu.edu>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hello Andy,
>>>>>>>> I am getting the following issue when i run the code,
>>>>>>>>
>>>>>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>>>>>>> function.FunctionBase1
>>>>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>>>>>
>>>>>>>> I have added the .class file in the directory. Do i need to package
>> the
>>>>>>>> dependancy jars also? Please advice.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Arun
>>>>>>>>
>>>>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>>>>>> akrish12@ncsu.edu> wrote:
>>>>>>>>
>>>>>>>> It is executing now Andy. Thanks a lot. I missed to add the
>> directory.
>>>>>>>>> Thanks again for this help.
>>>>>>>>>
>>>>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>
>>>>>>>>>> So my JENA_CP
>>>>>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>>>>>>> /Documents'.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> Does the file
>>>>>>>>>>
>>>>>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>>>>>
>>>>>>>>>> exist?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>>>>> But still when i run this command,
>>>>>>>>>>>
>>>>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>>
>>>>>>>>>>> I am getting the below error,
>>>>>>>>>>>
>>>>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>> --data
>>>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>>>>>> samplejena.LastModified
>>>>>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>>>>>> <java:samplejena.LastModified>
>>>>>>>>>>> has no registered function factory
>>>>>>>>>>> -------------
>>>>>>>>>>> | title | r |
>>>>>>>>>>> =============
>>>>>>>>>>> -------------
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>> Arun
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> The list doesn't accept attachments.
>>>>>>>>>>>
>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>>>>
>>>>>>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>>>>>
>>>>>>>>>>>> In the original it says:
>>>>>>>>>>>>
>>>>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>>>>>
>>>>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>>>>>> jars in
>>>>>>>>>>>> that direct on the classpath.
>>>>>>>>>>>>
>>>>>>>>>>>> For you:
>>>>>>>>>>>>
>>>>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>>>>>
>>>>>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>>>>>
>>>>>>>>>>>> As you have: java:samplejena
>>>>>>>>>>>>
>>>>>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
>>>>>>>>>>>> is one
>>>>>>>>>>>> directory within /DIR.
>>>>>>>>>>>>
>>>>>>>>>>>> You then want:
>>>>>>>>>>>>
>>>>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>>>>>
>>>>>>>>>>>> : is the classpath separator.
>>>>>>>>>>>>
>>>>>>>>>>>>       Andy
>>>>>>>>>>>>
>>>>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>>>>>> not find
>>>>>>>>>>>>> or
>>>>>>>>>>>>> load main class arq.arq
>>>>>>>>>>>>>
>>>>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>>>>>>> whether
>>>>>>>>>>>>> my change is correct.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> Arun
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <
>> andy@apache.org
>>>>>>>>>>>>> <mailto:
>>>>>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>       Hi - Please send email to the jena users mailing list.
>>>>>>>>>>>>>
>>>>>>>>>>>>>       (It is correct if it works!)
>>>>>>>>>>>>>
>>>>>>>>>>>>>            Andy
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>
>>


Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
But i have given the type as xsd:dateTime, so it should take it right?

On Thu, Aug 9, 2018 at 3:24 PM, ajs6f <aj...@apache.org> wrote:

> > 13:44:11 WARN  NodeValue            :: Datatype format exception:
> > "1969-12-31T19:00:00"^^xsd:date
>
> No, Jena is just telling you (quite correctly) that "1969-12-31T19:00:00"
> is not an xsd:date. Notice the time that is included. xsd:date does not
> include time.
>
> ajs6f
>
> > On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
> wrote:
> >
> > Hello Andy,
> >
> > I am getting the below error when i run the query against the dataset
> > shared with you,
> >
> > PREFIX myfn: <java:samplejena.>
> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> > PREFIX dc: <http://purl.org/dc/elements/1.1/>
> > PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> > SELECT ?title ?r
> > WHERE {
> > ?s rdfs:seeAlso ?r.
> > OPTIONAL {?r dc:title ?title.}
> > FILTER ( isURI(?r) &&
> > myfn:LastModified(?r) >
> > "2005-11-06T00:00:00Z"^^xsd:dateTime )
> > }
> >
> > 13:44:11 WARN  NodeValue            :: Datatype format exception:
> > "1969-12-31T19:00:00"^^xsd:date
> >
> > Is this because of any old version or something?
> >
> >
> >
> > On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:
> >
> >> Good question - there is still a noticeable tail of com.hp.hpl, here and
> >> on Stackoverflow.
> >>
> >> Some is due to old apps; that is good in that the software is useful
> >> enough to be used for such a long time.
> >>
> >> I suspect that some of the rest is university courses providing the
> >> materials that have not been updated.
> >>
> >> (Jena3 was 2015-07-29)
> >>
> >>    Andy
> >>
> >>
> >> On 09/08/18 06:48, Lorenz Buehmann wrote:
> >>
> >>> I'm always wondering how people that are new to Apache Jena still use
> >>> the old version. I mean, the first hit via Google is the Apache Jena
> >>> webpage which clearly refers to the latest version.
> >>>
> >>> In the current case, he just copied the code example from [1] which
> >>> indeed uses the old version given that the blog entry is from 2005.
> >>> Well, at this time I didn't know about Semantic Web at all...
> >>>
> >>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
> >>>
> >>>
> >>> On 08.08.2018 22:14, Andy Seaborne wrote:
> >>>
> >>>> com.hp.hpl.jena -- that's Jena2.
> >>>>
> >>>> Packages are "org.apache.jena" in Jena3.
> >>>>
> >>>> The code seems to have been compiled against Jena2 and run against
> >>>> Jena3.  That won't work.
> >>>>
> >>>>     Andy
> >>>>
> >>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
> >>>>
> >>>>> The java code i am executing is,
> >>>>>
> >>>>> package samplejena;
> >>>>>
> >>>>> import com.hp.hpl.jena.query.expr.NodeValue;
> >>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
> >>>>>
> >>>>> import java.net.*;
> >>>>> import java.text.SimpleDateFormat;
> >>>>> import java.util.*;
> >>>>>
> >>>>> public class LastModified extends FunctionBase1
> >>>>> {
> >>>>> private static final SimpleDateFormat format = new
> >>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
> >>>>> private Map _cache;
> >>>>> public LastModified()
> >>>>> {
> >>>>> _cache = new HashMap();
> >>>>> }
> >>>>> public NodeValue exec(NodeValue nodeValue)
> >>>>> {
> >>>>> String value = nodeValue.asString();
> >>>>> if (_cache.containsKey(value))
> >>>>> {
> >>>>> return (NodeValue)_cache.get(value);
> >>>>> }
> >>>>>          String lastModified = "";
> >>>>> try {
> >>>>> lastModified = getLastModified( nodeValue.asString() );
> >>>>> } catch (Exception e) {
> >>>>> // TODO Auto-generated catch block
> >>>>> e.printStackTrace();
> >>>>> }
> >>>>>
> >>>>>          NodeValue date = NodeValue.makeDate(lastModified);
> >>>>>          _cache.put(value, date);
> >>>>>          return date;
> >>>>> }
> >>>>> public String getLastModified(String link) throws Exception
> >>>>> {
> >>>>> URL url = new URL(link);
> >>>>> URLConnection connection = url.openConnection();
> >>>>> connection.setAllowUserInteraction(false);
> >>>>> long secs = connection.getLastModified();
> >>>>> String xsdDate = dateToXSD(secs);
> >>>>> return xsdDate;
> >>>>> }
> >>>>> public String dateToXSD(long secs)
> >>>>> {
> >>>>> Date date = new Date(secs);
> >>>>> return format.format(date);
> >>>>> }
> >>>>> }
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
> >>>>> <ak...@ncsu.edu>
> >>>>> wrote:
> >>>>>
> >>>>> Hello Andy,
> >>>>>>
> >>>>>> I am getting the following issue when i run the code,
> >>>>>>
> >>>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
> >>>>>> function.FunctionBase1
> >>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> >>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> >>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
> >>>>>>
> >>>>>> I have added the .class file in the directory. Do i need to package
> the
> >>>>>> dependancy jars also? Please advice.
> >>>>>>
> >>>>>> Regards,
> >>>>>> Arun
> >>>>>>
> >>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
> >>>>>> akrish12@ncsu.edu> wrote:
> >>>>>>
> >>>>>> It is executing now Andy. Thanks a lot. I missed to add the
> directory.
> >>>>>>> Thanks again for this help.
> >>>>>>>
> >>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>>
> >>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
> >>>>>>>>
> >>>>>>>> So my JENA_CP
> >>>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
> >>>>>>>>> /Documents'.
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> Does the file
> >>>>>>>>
> >>>>>>>> /home/ak/Documents/samplejena/LastModified.class
> >>>>>>>>
> >>>>>>>> exist?
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> /home/ak/Documents location has the classfile/jar of the code
> >>>>>>>>>
> >>>>>>>>> But still when i run this command,
> >>>>>>>>>
> >>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
> >>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> >>>>>>>>>
> >>>>>>>>> I am getting the below error,
> >>>>>>>>>
> >>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq
> --data
> >>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> >>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
> >>>>>>>>> samplejena.LastModified
> >>>>>>>>> 12:41:35 WARN  exec                 :: URI
> >>>>>>>>> <java:samplejena.LastModified>
> >>>>>>>>> has no registered function factory
> >>>>>>>>> -------------
> >>>>>>>>> | title | r |
> >>>>>>>>> =============
> >>>>>>>>> -------------
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Regards,
> >>>>>>>>> Arun
> >>>>>>>>>
> >>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>> The list doesn't accept attachments.
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
> >>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>> This needs to be a valid java classpath.
> >>>>>>>>>>
> >>>>>>>>>> $JENA_HOME is directory of the Jena installation.
> >>>>>>>>>>
> >>>>>>>>>> In the original it says:
> >>>>>>>>>>
> >>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
> >>>>>>>>>>
> >>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
> >>>>>>>>>> jars in
> >>>>>>>>>> that direct on the classpath.
> >>>>>>>>>>
> >>>>>>>>>> For you:
> >>>>>>>>>>
> >>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
> >>>>>>>>>>
> >>>>>>>>>> You need to add the package/classfile tree for you code.
> >>>>>>>>>>
> >>>>>>>>>> As you have: java:samplejena
> >>>>>>>>>>
> >>>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
> >>>>>>>>>> is one
> >>>>>>>>>> directory within /DIR.
> >>>>>>>>>>
> >>>>>>>>>> You then want:
> >>>>>>>>>>
> >>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
> >>>>>>>>>>
> >>>>>>>>>> : is the classpath separator.
> >>>>>>>>>>
> >>>>>>>>>>       Andy
> >>>>>>>>>>
> >>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
> >>>>>>>>>>
> >>>>>>>>>> Hello,
> >>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> I have attached the file with the change, i am getting Could
> >>>>>>>>>>> not find
> >>>>>>>>>>> or
> >>>>>>>>>>> load main class arq.arq
> >>>>>>>>>>>
> >>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
> >>>>>>>>>>> whether
> >>>>>>>>>>> my change is correct.
> >>>>>>>>>>>
> >>>>>>>>>>> Regards,
> >>>>>>>>>>> Arun
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <
> andy@apache.org
> >>>>>>>>>>> <mailto:
> >>>>>>>>>>> andy@apache.org>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>       Hi - Please send email to the jena users mailing list.
> >>>>>>>>>>>
> >>>>>>>>>>>       (It is correct if it works!)
> >>>>>>>>>>>
> >>>>>>>>>>>            Andy
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>
> >>>
>
>

Re: Writing an ARQ Extension Function

Posted by ajs6f <aj...@apache.org>.
> 13:44:11 WARN  NodeValue            :: Datatype format exception:
> "1969-12-31T19:00:00"^^xsd:date

No, Jena is just telling you (quite correctly) that "1969-12-31T19:00:00" is not an xsd:date. Notice the time that is included. xsd:date does not include time.

ajs6f

> On Aug 9, 2018, at 2:35 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu> wrote:
> 
> Hello Andy,
> 
> I am getting the below error when i run the query against the dataset
> shared with you,
> 
> PREFIX myfn: <java:samplejena.>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> SELECT ?title ?r
> WHERE {
> ?s rdfs:seeAlso ?r.
> OPTIONAL {?r dc:title ?title.}
> FILTER ( isURI(?r) &&
> myfn:LastModified(?r) >
> "2005-11-06T00:00:00Z"^^xsd:dateTime )
> }
> 
> 13:44:11 WARN  NodeValue            :: Datatype format exception:
> "1969-12-31T19:00:00"^^xsd:date
> 
> Is this because of any old version or something?
> 
> 
> 
> On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:
> 
>> Good question - there is still a noticeable tail of com.hp.hpl, here and
>> on Stackoverflow.
>> 
>> Some is due to old apps; that is good in that the software is useful
>> enough to be used for such a long time.
>> 
>> I suspect that some of the rest is university courses providing the
>> materials that have not been updated.
>> 
>> (Jena3 was 2015-07-29)
>> 
>>    Andy
>> 
>> 
>> On 09/08/18 06:48, Lorenz Buehmann wrote:
>> 
>>> I'm always wondering how people that are new to Apache Jena still use
>>> the old version. I mean, the first hit via Google is the Apache Jena
>>> webpage which clearly refers to the latest version.
>>> 
>>> In the current case, he just copied the code example from [1] which
>>> indeed uses the old version given that the blog entry is from 2005.
>>> Well, at this time I didn't know about Semantic Web at all...
>>> 
>>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
>>> 
>>> 
>>> On 08.08.2018 22:14, Andy Seaborne wrote:
>>> 
>>>> com.hp.hpl.jena -- that's Jena2.
>>>> 
>>>> Packages are "org.apache.jena" in Jena3.
>>>> 
>>>> The code seems to have been compiled against Jena2 and run against
>>>> Jena3.  That won't work.
>>>> 
>>>>     Andy
>>>> 
>>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>>> 
>>>>> The java code i am executing is,
>>>>> 
>>>>> package samplejena;
>>>>> 
>>>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>>> 
>>>>> import java.net.*;
>>>>> import java.text.SimpleDateFormat;
>>>>> import java.util.*;
>>>>> 
>>>>> public class LastModified extends FunctionBase1
>>>>> {
>>>>> private static final SimpleDateFormat format = new
>>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>>>> private Map _cache;
>>>>> public LastModified()
>>>>> {
>>>>> _cache = new HashMap();
>>>>> }
>>>>> public NodeValue exec(NodeValue nodeValue)
>>>>> {
>>>>> String value = nodeValue.asString();
>>>>> if (_cache.containsKey(value))
>>>>> {
>>>>> return (NodeValue)_cache.get(value);
>>>>> }
>>>>>          String lastModified = "";
>>>>> try {
>>>>> lastModified = getLastModified( nodeValue.asString() );
>>>>> } catch (Exception e) {
>>>>> // TODO Auto-generated catch block
>>>>> e.printStackTrace();
>>>>> }
>>>>> 
>>>>>          NodeValue date = NodeValue.makeDate(lastModified);
>>>>>          _cache.put(value, date);
>>>>>          return date;
>>>>> }
>>>>> public String getLastModified(String link) throws Exception
>>>>> {
>>>>> URL url = new URL(link);
>>>>> URLConnection connection = url.openConnection();
>>>>> connection.setAllowUserInteraction(false);
>>>>> long secs = connection.getLastModified();
>>>>> String xsdDate = dateToXSD(secs);
>>>>> return xsdDate;
>>>>> }
>>>>> public String dateToXSD(long secs)
>>>>> {
>>>>> Date date = new Date(secs);
>>>>> return format.format(date);
>>>>> }
>>>>> }
>>>>> 
>>>>> 
>>>>> 
>>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>>>> <ak...@ncsu.edu>
>>>>> wrote:
>>>>> 
>>>>> Hello Andy,
>>>>>> 
>>>>>> I am getting the following issue when i run the code,
>>>>>> 
>>>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>>>>> function.FunctionBase1
>>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>>> 
>>>>>> I have added the .class file in the directory. Do i need to package the
>>>>>> dependancy jars also? Please advice.
>>>>>> 
>>>>>> Regards,
>>>>>> Arun
>>>>>> 
>>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>>>> akrish12@ncsu.edu> wrote:
>>>>>> 
>>>>>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>>>>>>> Thanks again for this help.
>>>>>>> 
>>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
>>>>>>> wrote:
>>>>>>> 
>>>>>>> 
>>>>>>>> 
>>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>>> 
>>>>>>>> So my JENA_CP
>>>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>>>>> /Documents'.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> Does the file
>>>>>>>> 
>>>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>>> 
>>>>>>>> exist?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>>> 
>>>>>>>>> But still when i run this command,
>>>>>>>>> 
>>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>> 
>>>>>>>>> I am getting the below error,
>>>>>>>>> 
>>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>>>> samplejena.LastModified
>>>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>>>> <java:samplejena.LastModified>
>>>>>>>>> has no registered function factory
>>>>>>>>> -------------
>>>>>>>>> | title | r |
>>>>>>>>> =============
>>>>>>>>> -------------
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Arun
>>>>>>>>> 
>>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>> The list doesn't accept attachments.
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>>> 
>>>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>>> 
>>>>>>>>>> In the original it says:
>>>>>>>>>> 
>>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>>> 
>>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>>>> jars in
>>>>>>>>>> that direct on the classpath.
>>>>>>>>>> 
>>>>>>>>>> For you:
>>>>>>>>>> 
>>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>>> 
>>>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>>> 
>>>>>>>>>> As you have: java:samplejena
>>>>>>>>>> 
>>>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
>>>>>>>>>> is one
>>>>>>>>>> directory within /DIR.
>>>>>>>>>> 
>>>>>>>>>> You then want:
>>>>>>>>>> 
>>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>>> 
>>>>>>>>>> : is the classpath separator.
>>>>>>>>>> 
>>>>>>>>>>       Andy
>>>>>>>>>> 
>>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>> 
>>>>>>>>>> Hello,
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>>>> not find
>>>>>>>>>>> or
>>>>>>>>>>> load main class arq.arq
>>>>>>>>>>> 
>>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>>>>> whether
>>>>>>>>>>> my change is correct.
>>>>>>>>>>> 
>>>>>>>>>>> Regards,
>>>>>>>>>>> Arun
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>>>>>>> <mailto:
>>>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>       Hi - Please send email to the jena users mailing list.
>>>>>>>>>>> 
>>>>>>>>>>>       (It is correct if it works!)
>>>>>>>>>>> 
>>>>>>>>>>>            Andy
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>> 
>>> 


Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
Hello Andy,

I am getting the below error when i run the query against the dataset
shared with you,

PREFIX myfn: <java:samplejena.>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?title ?r
WHERE {
?s rdfs:seeAlso ?r.
OPTIONAL {?r dc:title ?title.}
FILTER ( isURI(?r) &&
myfn:LastModified(?r) >
"2005-11-06T00:00:00Z"^^xsd:dateTime )
}

13:44:11 WARN  NodeValue            :: Datatype format exception:
"1969-12-31T19:00:00"^^xsd:date

Is this because of any old version or something?



On Thu, Aug 9, 2018 at 6:34 AM, Andy Seaborne <an...@apache.org> wrote:

> Good question - there is still a noticeable tail of com.hp.hpl, here and
> on Stackoverflow.
>
> Some is due to old apps; that is good in that the software is useful
> enough to be used for such a long time.
>
> I suspect that some of the rest is university courses providing the
> materials that have not been updated.
>
> (Jena3 was 2015-07-29)
>
>     Andy
>
>
> On 09/08/18 06:48, Lorenz Buehmann wrote:
>
>> I'm always wondering how people that are new to Apache Jena still use
>> the old version. I mean, the first hit via Google is the Apache Jena
>> webpage which clearly refers to the latest version.
>>
>> In the current case, he just copied the code example from [1] which
>> indeed uses the old version given that the blog entry is from 2005.
>> Well, at this time I didn't know about Semantic Web at all...
>>
>> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
>>
>>
>> On 08.08.2018 22:14, Andy Seaborne wrote:
>>
>>> com.hp.hpl.jena -- that's Jena2.
>>>
>>> Packages are "org.apache.jena" in Jena3.
>>>
>>> The code seems to have been compiled against Jena2 and run against
>>> Jena3.  That won't work.
>>>
>>>      Andy
>>>
>>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>>
>>>> The java code i am executing is,
>>>>
>>>> package samplejena;
>>>>
>>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>>
>>>> import java.net.*;
>>>> import java.text.SimpleDateFormat;
>>>> import java.util.*;
>>>>
>>>> public class LastModified extends FunctionBase1
>>>> {
>>>> private static final SimpleDateFormat format = new
>>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>>> private Map _cache;
>>>> public LastModified()
>>>> {
>>>> _cache = new HashMap();
>>>> }
>>>> public NodeValue exec(NodeValue nodeValue)
>>>> {
>>>> String value = nodeValue.asString();
>>>> if (_cache.containsKey(value))
>>>> {
>>>> return (NodeValue)_cache.get(value);
>>>> }
>>>>           String lastModified = "";
>>>> try {
>>>> lastModified = getLastModified( nodeValue.asString() );
>>>> } catch (Exception e) {
>>>> // TODO Auto-generated catch block
>>>> e.printStackTrace();
>>>> }
>>>>
>>>>           NodeValue date = NodeValue.makeDate(lastModified);
>>>>           _cache.put(value, date);
>>>>           return date;
>>>> }
>>>> public String getLastModified(String link) throws Exception
>>>> {
>>>> URL url = new URL(link);
>>>> URLConnection connection = url.openConnection();
>>>> connection.setAllowUserInteraction(false);
>>>> long secs = connection.getLastModified();
>>>> String xsdDate = dateToXSD(secs);
>>>> return xsdDate;
>>>> }
>>>> public String dateToXSD(long secs)
>>>> {
>>>> Date date = new Date(secs);
>>>> return format.format(date);
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>>> <ak...@ncsu.edu>
>>>> wrote:
>>>>
>>>> Hello Andy,
>>>>>
>>>>> I am getting the following issue when i run the code,
>>>>>
>>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>>>> function.FunctionBase1
>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>>
>>>>> I have added the .class file in the directory. Do i need to package the
>>>>> dependancy jars also? Please advice.
>>>>>
>>>>> Regards,
>>>>> Arun
>>>>>
>>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>>> akrish12@ncsu.edu> wrote:
>>>>>
>>>>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>>>>>> Thanks again for this help.
>>>>>>
>>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>>
>>>>>>> So my JENA_CP
>>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>>>> /Documents'.
>>>>>>>>
>>>>>>>>
>>>>>>> Does the file
>>>>>>>
>>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>>
>>>>>>> exist?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>>
>>>>>>>> But still when i run this command,
>>>>>>>>
>>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>>
>>>>>>>> I am getting the below error,
>>>>>>>>
>>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>>> samplejena.LastModified
>>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>>> <java:samplejena.LastModified>
>>>>>>>> has no registered function factory
>>>>>>>> -------------
>>>>>>>> | title | r |
>>>>>>>> =============
>>>>>>>> -------------
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Arun
>>>>>>>>
>>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> The list doesn't accept attachments.
>>>>>>>>
>>>>>>>>>
>>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>>
>>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>>
>>>>>>>>> In the original it says:
>>>>>>>>>
>>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>>
>>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>>> jars in
>>>>>>>>> that direct on the classpath.
>>>>>>>>>
>>>>>>>>> For you:
>>>>>>>>>
>>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>>
>>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>>
>>>>>>>>> As you have: java:samplejena
>>>>>>>>>
>>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
>>>>>>>>> is one
>>>>>>>>> directory within /DIR.
>>>>>>>>>
>>>>>>>>> You then want:
>>>>>>>>>
>>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>>
>>>>>>>>> : is the classpath separator.
>>>>>>>>>
>>>>>>>>>        Andy
>>>>>>>>>
>>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>>> not find
>>>>>>>>>> or
>>>>>>>>>> load main class arq.arq
>>>>>>>>>>
>>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>>>> whether
>>>>>>>>>> my change is correct.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Arun
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>>>>>> <mailto:
>>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>>
>>>>>>>>>>        Hi - Please send email to the jena users mailing list.
>>>>>>>>>>
>>>>>>>>>>        (It is correct if it works!)
>>>>>>>>>>
>>>>>>>>>>             Andy
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.
Good question - there is still a noticeable tail of com.hp.hpl, here and 
on Stackoverflow.

Some is due to old apps; that is good in that the software is useful 
enough to be used for such a long time.

I suspect that some of the rest is university courses providing the 
materials that have not been updated.

(Jena3 was 2015-07-29)

     Andy

On 09/08/18 06:48, Lorenz Buehmann wrote:
> I'm always wondering how people that are new to Apache Jena still use
> the old version. I mean, the first hit via Google is the Apache Jena
> webpage which clearly refers to the latest version.
> 
> In the current case, he just copied the code example from [1] which
> indeed uses the old version given that the blog entry is from 2005.
> Well, at this time I didn't know about Semantic Web at all...
> 
> [1] http://www.ldodds.com/projects/sparql/LastModified.txt
> 
> 
> On 08.08.2018 22:14, Andy Seaborne wrote:
>> com.hp.hpl.jena -- that's Jena2.
>>
>> Packages are "org.apache.jena" in Jena3.
>>
>> The code seems to have been compiled against Jena2 and run against
>> Jena3.  That won't work.
>>
>>      Andy
>>
>> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>>> The java code i am executing is,
>>>
>>> package samplejena;
>>>
>>> import com.hp.hpl.jena.query.expr.NodeValue;
>>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>>
>>> import java.net.*;
>>> import java.text.SimpleDateFormat;
>>> import java.util.*;
>>>
>>> public class LastModified extends FunctionBase1
>>> {
>>> private static final SimpleDateFormat format = new
>>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>>> private Map _cache;
>>> public LastModified()
>>> {
>>> _cache = new HashMap();
>>> }
>>> public NodeValue exec(NodeValue nodeValue)
>>> {
>>> String value = nodeValue.asString();
>>> if (_cache.containsKey(value))
>>> {
>>> return (NodeValue)_cache.get(value);
>>> }
>>>           String lastModified = "";
>>> try {
>>> lastModified = getLastModified( nodeValue.asString() );
>>> } catch (Exception e) {
>>> // TODO Auto-generated catch block
>>> e.printStackTrace();
>>> }
>>>
>>>           NodeValue date = NodeValue.makeDate(lastModified);
>>>           _cache.put(value, date);
>>>           return date;
>>> }
>>> public String getLastModified(String link) throws Exception
>>> {
>>> URL url = new URL(link);
>>> URLConnection connection = url.openConnection();
>>> connection.setAllowUserInteraction(false);
>>> long secs = connection.getLastModified();
>>> String xsdDate = dateToXSD(secs);
>>> return xsdDate;
>>> }
>>> public String dateToXSD(long secs)
>>> {
>>> Date date = new Date(secs);
>>> return format.format(date);
>>> }
>>> }
>>>
>>>
>>>
>>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>>> <ak...@ncsu.edu>
>>> wrote:
>>>
>>>> Hello Andy,
>>>>
>>>> I am getting the following issue when i run the code,
>>>>
>>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>>> function.FunctionBase1
>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>>
>>>> I have added the .class file in the directory. Do i need to package the
>>>> dependancy jars also? Please advice.
>>>>
>>>> Regards,
>>>> Arun
>>>>
>>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>>> akrish12@ncsu.edu> wrote:
>>>>
>>>>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>>>>> Thanks again for this help.
>>>>>
>>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>>
>>>>>>> So my JENA_CP
>>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>>> /Documents'.
>>>>>>>
>>>>>>
>>>>>> Does the file
>>>>>>
>>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>>
>>>>>> exist?
>>>>>>
>>>>>>
>>>>>>
>>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>>
>>>>>>> But still when i run this command,
>>>>>>>
>>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>>
>>>>>>> I am getting the below error,
>>>>>>>
>>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>>> samplejena.LastModified
>>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>>> <java:samplejena.LastModified>
>>>>>>> has no registered function factory
>>>>>>> -------------
>>>>>>> | title | r |
>>>>>>> =============
>>>>>>> -------------
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> Arun
>>>>>>>
>>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>> The list doesn't accept attachments.
>>>>>>>>
>>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>>
>>>>>>>>>
>>>>>>>> This needs to be a valid java classpath.
>>>>>>>>
>>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>>
>>>>>>>> In the original it says:
>>>>>>>>
>>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>>
>>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>>> jars in
>>>>>>>> that direct on the classpath.
>>>>>>>>
>>>>>>>> For you:
>>>>>>>>
>>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>>
>>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>>
>>>>>>>> As you have: java:samplejena
>>>>>>>>
>>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"
>>>>>>>> is one
>>>>>>>> directory within /DIR.
>>>>>>>>
>>>>>>>> You then want:
>>>>>>>>
>>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>>
>>>>>>>> : is the classpath separator.
>>>>>>>>
>>>>>>>>        Andy
>>>>>>>>
>>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>>> not find
>>>>>>>>> or
>>>>>>>>> load main class arq.arq
>>>>>>>>>
>>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>>> whether
>>>>>>>>> my change is correct.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Arun
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>>>>> <mailto:
>>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>>
>>>>>>>>>        Hi - Please send email to the jena users mailing list.
>>>>>>>>>
>>>>>>>>>        (It is correct if it works!)
>>>>>>>>>
>>>>>>>>>             Andy
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
> 
> 

Re: Writing an ARQ Extension Function

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
I'm always wondering how people that are new to Apache Jena still use
the old version. I mean, the first hit via Google is the Apache Jena
webpage which clearly refers to the latest version.

In the current case, he just copied the code example from [1] which
indeed uses the old version given that the blog entry is from 2005.
Well, at this time I didn't know about Semantic Web at all...

[1] http://www.ldodds.com/projects/sparql/LastModified.txt


On 08.08.2018 22:14, Andy Seaborne wrote:
> com.hp.hpl.jena -- that's Jena2.
>
> Packages are "org.apache.jena" in Jena3.
>
> The code seems to have been compiled against Jena2 and run against
> Jena3.  That won't work.
>
>     Andy
>
> On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
>> The java code i am executing is,
>>
>> package samplejena;
>>
>> import com.hp.hpl.jena.query.expr.NodeValue;
>> import com.hp.hpl.jena.query.function.FunctionBase1;
>>
>> import java.net.*;
>> import java.text.SimpleDateFormat;
>> import java.util.*;
>>
>> public class LastModified extends FunctionBase1
>> {
>> private static final SimpleDateFormat format = new
>> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
>> private Map _cache;
>> public LastModified()
>> {
>> _cache = new HashMap();
>> }
>> public NodeValue exec(NodeValue nodeValue)
>> {
>> String value = nodeValue.asString();
>> if (_cache.containsKey(value))
>> {
>> return (NodeValue)_cache.get(value);
>> }
>>          String lastModified = "";
>> try {
>> lastModified = getLastModified( nodeValue.asString() );
>> } catch (Exception e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>>
>>          NodeValue date = NodeValue.makeDate(lastModified);
>>          _cache.put(value, date);
>>          return date;
>> }
>> public String getLastModified(String link) throws Exception
>> {
>> URL url = new URL(link);
>> URLConnection connection = url.openConnection();
>> connection.setAllowUserInteraction(false);
>> long secs = connection.getLastModified();
>> String xsdDate = dateToXSD(secs);
>> return xsdDate;
>> }
>> public String dateToXSD(long secs)
>> {
>> Date date = new Date(secs);
>> return format.format(date);
>> }
>> }
>>
>>
>>
>> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy
>> <ak...@ncsu.edu>
>> wrote:
>>
>>> Hello Andy,
>>>
>>> I am getting the following issue when i run the code,
>>>
>>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>>> function.FunctionBase1
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>>
>>> I have added the .class file in the directory. Do i need to package the
>>> dependancy jars also? Please advice.
>>>
>>> Regards,
>>> Arun
>>>
>>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>>> akrish12@ncsu.edu> wrote:
>>>
>>>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>>>> Thanks again for this help.
>>>>
>>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>>>
>>>>>
>>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>>
>>>>>> So my JENA_CP
>>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>>> /Documents'.
>>>>>>
>>>>>
>>>>> Does the file
>>>>>
>>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>>
>>>>> exist?
>>>>>
>>>>>
>>>>>
>>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>>
>>>>>> But still when i run this command,
>>>>>>
>>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>>
>>>>>> I am getting the below error,
>>>>>>
>>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>>> samplejena.LastModified
>>>>>> 12:41:35 WARN  exec                 :: URI
>>>>>> <java:samplejena.LastModified>
>>>>>> has no registered function factory
>>>>>> -------------
>>>>>> | title | r |
>>>>>> =============
>>>>>> -------------
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>> Arun
>>>>>>
>>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>> The list doesn't accept attachments.
>>>>>>>
>>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>>
>>>>>>>>
>>>>>>> This needs to be a valid java classpath.
>>>>>>>
>>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>>
>>>>>>> In the original it says:
>>>>>>>
>>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>>
>>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the
>>>>>>> jars in
>>>>>>> that direct on the classpath.
>>>>>>>
>>>>>>> For you:
>>>>>>>
>>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>>
>>>>>>> You need to add the package/classfile tree for you code.
>>>>>>>
>>>>>>> As you have: java:samplejena
>>>>>>>
>>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena" 
>>>>>>> is one
>>>>>>> directory within /DIR.
>>>>>>>
>>>>>>> You then want:
>>>>>>>
>>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>>
>>>>>>> : is the classpath separator.
>>>>>>>
>>>>>>>       Andy
>>>>>>>
>>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I have attached the file with the change, i am getting Could
>>>>>>>> not find
>>>>>>>> or
>>>>>>>> load main class arq.arq
>>>>>>>>
>>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>>> whether
>>>>>>>> my change is correct.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Arun
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>>>> <mailto:
>>>>>>>> andy@apache.org>> wrote:
>>>>>>>>
>>>>>>>>       Hi - Please send email to the jena users mailing list.
>>>>>>>>
>>>>>>>>       (It is correct if it works!)
>>>>>>>>
>>>>>>>>            Andy
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>



Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.
com.hp.hpl.jena -- that's Jena2.

Packages are "org.apache.jena" in Jena3.

The code seems to have been compiled against Jena2 and run against 
Jena3.  That won't work.

     Andy

On 08/08/18 18:14, Arunkumar Krishnamoorthy wrote:
> The java code i am executing is,
> 
> package samplejena;
> 
> import com.hp.hpl.jena.query.expr.NodeValue;
> import com.hp.hpl.jena.query.function.FunctionBase1;
> 
> import java.net.*;
> import java.text.SimpleDateFormat;
> import java.util.*;
> 
> public class LastModified extends FunctionBase1
> {
> private static final SimpleDateFormat format = new
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
> private Map _cache;
> public LastModified()
> {
> _cache = new HashMap();
> }
> public NodeValue exec(NodeValue nodeValue)
> {
> String value = nodeValue.asString();
> if (_cache.containsKey(value))
> {
> return (NodeValue)_cache.get(value);
> }
>          String lastModified = "";
> try {
> lastModified = getLastModified( nodeValue.asString() );
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> 
>          NodeValue date = NodeValue.makeDate(lastModified);
>          _cache.put(value, date);
>          return date;
> }
> public String getLastModified(String link) throws Exception
> {
> URL url = new URL(link);
> URLConnection connection = url.openConnection();
> connection.setAllowUserInteraction(false);
> long secs = connection.getLastModified();
> String xsdDate = dateToXSD(secs);
> return xsdDate;
> }
> public String dateToXSD(long secs)
> {
> Date date = new Date(secs);
> return format.format(date);
> }
> }
> 
> 
> 
> On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
> wrote:
> 
>> Hello Andy,
>>
>> I am getting the following issue when i run the code,
>>
>> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
>> function.FunctionBase1
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>>
>> I have added the .class file in the directory. Do i need to package the
>> dependancy jars also? Please advice.
>>
>> Regards,
>> Arun
>>
>> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
>> akrish12@ncsu.edu> wrote:
>>
>>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>>> Thanks again for this help.
>>>
>>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>>>
>>>>
>>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>>
>>>>> So my JENA_CP
>>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>>> /Documents'.
>>>>>
>>>>
>>>> Does the file
>>>>
>>>> /home/ak/Documents/samplejena/LastModified.class
>>>>
>>>> exist?
>>>>
>>>>
>>>>
>>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>>
>>>>> But still when i run this command,
>>>>>
>>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>>
>>>>> I am getting the below error,
>>>>>
>>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>>> samplejena.LastModified
>>>>> 12:41:35 WARN  exec                 :: URI
>>>>> <java:samplejena.LastModified>
>>>>> has no registered function factory
>>>>> -------------
>>>>> | title | r |
>>>>> =============
>>>>> -------------
>>>>>
>>>>>
>>>>> Regards,
>>>>> Arun
>>>>>
>>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>>
>>>>> The list doesn't accept attachments.
>>>>>>
>>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>>
>>>>>>>
>>>>>> This needs to be a valid java classpath.
>>>>>>
>>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>>
>>>>>> In the original it says:
>>>>>>
>>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>>
>>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
>>>>>> that direct on the classpath.
>>>>>>
>>>>>> For you:
>>>>>>
>>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>>
>>>>>> You need to add the package/classfile tree for you code.
>>>>>>
>>>>>> As you have: java:samplejena
>>>>>>
>>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
>>>>>> directory within /DIR.
>>>>>>
>>>>>> You then want:
>>>>>>
>>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>>
>>>>>> : is the classpath separator.
>>>>>>
>>>>>>       Andy
>>>>>>
>>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>>
>>>>>> Hello,
>>>>>>>
>>>>>>> I have attached the file with the change, i am getting Could not find
>>>>>>> or
>>>>>>> load main class arq.arq
>>>>>>>
>>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>>> whether
>>>>>>> my change is correct.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Arun
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>>> <mailto:
>>>>>>> andy@apache.org>> wrote:
>>>>>>>
>>>>>>>       Hi - Please send email to the jena users mailing list.
>>>>>>>
>>>>>>>       (It is correct if it works!)
>>>>>>>
>>>>>>>            Andy
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>
> 

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
The java code i am executing is,

package samplejena;

import com.hp.hpl.jena.query.expr.NodeValue;
import com.hp.hpl.jena.query.function.FunctionBase1;

import java.net.*;
import java.text.SimpleDateFormat;
import java.util.*;

public class LastModified extends FunctionBase1
{
private static final SimpleDateFormat format = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
private Map _cache;
public LastModified()
{
_cache = new HashMap();
}
public NodeValue exec(NodeValue nodeValue)
{
String value = nodeValue.asString();
if (_cache.containsKey(value))
{
return (NodeValue)_cache.get(value);
}
        String lastModified = "";
try {
lastModified = getLastModified( nodeValue.asString() );
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

        NodeValue date = NodeValue.makeDate(lastModified);
        _cache.put(value, date);
        return date;
}
public String getLastModified(String link) throws Exception
{
URL url = new URL(link);
URLConnection connection = url.openConnection();
connection.setAllowUserInteraction(false);
long secs = connection.getLastModified();
String xsdDate = dateToXSD(secs);
return xsdDate;
}
public String dateToXSD(long secs)
{
Date date = new Date(secs);
return format.format(date);
}
}



On Wed, Aug 8, 2018 at 1:14 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
wrote:

> Hello Andy,
>
> I am getting the following issue when i run the code,
>
> Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.query.
> function.FunctionBase1
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j
>
> I have added the .class file in the directory. Do i need to package the
> dependancy jars also? Please advice.
>
> Regards,
> Arun
>
> On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <
> akrish12@ncsu.edu> wrote:
>
>> It is executing now Andy. Thanks a lot. I missed to add the directory.
>> Thanks again for this help.
>>
>> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>>
>>>
>>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>>
>>>> So my JENA_CP
>>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>>> /Documents'.
>>>>
>>>
>>> Does the file
>>>
>>> /home/ak/Documents/samplejena/LastModified.class
>>>
>>> exist?
>>>
>>>
>>>
>>>> /home/ak/Documents location has the classfile/jar of the code
>>>>
>>>> But still when i run this command,
>>>>
>>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>>
>>>> I am getting the below error,
>>>>
>>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>>> samplejena.LastModified
>>>> 12:41:35 WARN  exec                 :: URI
>>>> <java:samplejena.LastModified>
>>>> has no registered function factory
>>>> -------------
>>>> | title | r |
>>>> =============
>>>> -------------
>>>>
>>>>
>>>> Regards,
>>>> Arun
>>>>
>>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> The list doesn't accept attachments.
>>>>>
>>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>>
>>>>>>
>>>>> This needs to be a valid java classpath.
>>>>>
>>>>> $JENA_HOME is directory of the Jena installation.
>>>>>
>>>>> In the original it says:
>>>>>
>>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>>
>>>>> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
>>>>> that direct on the classpath.
>>>>>
>>>>> For you:
>>>>>
>>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>>
>>>>> You need to add the package/classfile tree for you code.
>>>>>
>>>>> As you have: java:samplejena
>>>>>
>>>>> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
>>>>> directory within /DIR.
>>>>>
>>>>> You then want:
>>>>>
>>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>>
>>>>> : is the classpath separator.
>>>>>
>>>>>      Andy
>>>>>
>>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>>
>>>>> Hello,
>>>>>>
>>>>>> I have attached the file with the change, i am getting Could not find
>>>>>> or
>>>>>> load main class arq.arq
>>>>>>
>>>>>> My classpath location is /home/ak/Documents. Please let me know
>>>>>> whether
>>>>>> my change is correct.
>>>>>>
>>>>>> Regards,
>>>>>> Arun
>>>>>>
>>>>>>
>>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>>> <mailto:
>>>>>> andy@apache.org>> wrote:
>>>>>>
>>>>>>      Hi - Please send email to the jena users mailing list.
>>>>>>
>>>>>>      (It is correct if it works!)
>>>>>>
>>>>>>           Andy
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>
>

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
Hello Andy,

I am getting the following issue when i run the code,

Caused by: java.lang.ClassNotFoundException:
com.hp.hpl.jena.query.function.FunctionBase1
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.j

I have added the .class file in the directory. Do i need to package the
dependancy jars also? Please advice.

Regards,
Arun

On Tue, Aug 7, 2018 at 2:11 PM, Arunkumar Krishnamoorthy <ak...@ncsu.edu>
wrote:

> It is executing now Andy. Thanks a lot. I missed to add the directory.
> Thanks again for this help.
>
> On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:
>
>>
>>
>> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>>
>>> So my JENA_CP
>>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>>> /Documents'.
>>>
>>
>> Does the file
>>
>> /home/ak/Documents/samplejena/LastModified.class
>>
>> exist?
>>
>>
>>
>>> /home/ak/Documents location has the classfile/jar of the code
>>>
>>> But still when i run this command,
>>>
>>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>>
>>> I am getting the below error,
>>>
>>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>> 12:41:35 WARN  ClsLoader            :: Class not found:
>>> samplejena.LastModified
>>> 12:41:35 WARN  exec                 :: URI <java:samplejena.LastModified>
>>> has no registered function factory
>>> -------------
>>> | title | r |
>>> =============
>>> -------------
>>>
>>>
>>> Regards,
>>> Arun
>>>
>>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> The list doesn't accept attachments.
>>>>
>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>>
>>>>>
>>>> This needs to be a valid java classpath.
>>>>
>>>> $JENA_HOME is directory of the Jena installation.
>>>>
>>>> In the original it says:
>>>>
>>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>>
>>>> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
>>>> that direct on the classpath.
>>>>
>>>> For you:
>>>>
>>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>>
>>>> You need to add the package/classfile tree for you code.
>>>>
>>>> As you have: java:samplejena
>>>>
>>>> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
>>>> directory within /DIR.
>>>>
>>>> You then want:
>>>>
>>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>>
>>>> : is the classpath separator.
>>>>
>>>>      Andy
>>>>
>>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>>
>>>> Hello,
>>>>>
>>>>> I have attached the file with the change, i am getting Could not find
>>>>> or
>>>>> load main class arq.arq
>>>>>
>>>>> My classpath location is /home/ak/Documents. Please let me know whether
>>>>> my change is correct.
>>>>>
>>>>> Regards,
>>>>> Arun
>>>>>
>>>>>
>>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>>> <mailto:
>>>>> andy@apache.org>> wrote:
>>>>>
>>>>>      Hi - Please send email to the jena users mailing list.
>>>>>
>>>>>      (It is correct if it works!)
>>>>>
>>>>>           Andy
>>>>>
>>>>>
>>>>
>>>>
>>>
>

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
It is executing now Andy. Thanks a lot. I missed to add the directory.
Thanks again for this help.

On Tue, Aug 7, 2018 at 2:06 PM, Andy Seaborne <an...@apache.org> wrote:

>
>
> On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
>
>> So my JENA_CP
>> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak
>> /Documents'.
>>
>
> Does the file
>
> /home/ak/Documents/samplejena/LastModified.class
>
> exist?
>
>
>
>> /home/ak/Documents location has the classfile/jar of the code
>>
>> But still when i run this command,
>>
>> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>
>> I am getting the below error,
>>
>> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>> 12:41:35 WARN  ClsLoader            :: Class not found:
>> samplejena.LastModified
>> 12:41:35 WARN  exec                 :: URI <java:samplejena.LastModified>
>> has no registered function factory
>> -------------
>> | title | r |
>> =============
>> -------------
>>
>>
>> Regards,
>> Arun
>>
>> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>> The list doesn't accept attachments.
>>>
>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>>>>
>>>>
>>> This needs to be a valid java classpath.
>>>
>>> $JENA_HOME is directory of the Jena installation.
>>>
>>> In the original it says:
>>>
>>> JENA_CP="$JENA_HOME"'/lib/*'
>>>
>>> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
>>> that direct on the classpath.
>>>
>>> For you:
>>>
>>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>>
>>> You need to add the package/classfile tree for you code.
>>>
>>> As you have: java:samplejena
>>>
>>> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
>>> directory within /DIR.
>>>
>>> You then want:
>>>
>>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>>
>>> : is the classpath separator.
>>>
>>>      Andy
>>>
>>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>>
>>> Hello,
>>>>
>>>> I have attached the file with the change, i am getting Could not find or
>>>> load main class arq.arq
>>>>
>>>> My classpath location is /home/ak/Documents. Please let me know whether
>>>> my change is correct.
>>>>
>>>> Regards,
>>>> Arun
>>>>
>>>>
>>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org
>>>> <mailto:
>>>> andy@apache.org>> wrote:
>>>>
>>>>      Hi - Please send email to the jena users mailing list.
>>>>
>>>>      (It is correct if it works!)
>>>>
>>>>           Andy
>>>>
>>>>
>>>
>>>
>>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.

On 07/08/18 18:07, Arunkumar Krishnamoorthy wrote:
> So my JENA_CP
> is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak/Documents'.

Does the file

/home/ak/Documents/samplejena/LastModified.class

exist?

> 
> /home/ak/Documents location has the classfile/jar of the code
> 
> But still when i run this command,
> 
> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> 
> I am getting the below error,
> 
> ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> 12:41:35 WARN  ClsLoader            :: Class not found:
> samplejena.LastModified
> 12:41:35 WARN  exec                 :: URI <java:samplejena.LastModified>
> has no registered function factory
> -------------
> | title | r |
> =============
> -------------
> 
> 
> Regards,
> Arun
> 
> On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:
> 
>> The list doesn't accept attachments.
>>
>>>> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>>
>> This needs to be a valid java classpath.
>>
>> $JENA_HOME is directory of the Jena installation.
>>
>> In the original it says:
>>
>> JENA_CP="$JENA_HOME"'/lib/*'
>>
>> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
>> that direct on the classpath.
>>
>> For you:
>>
>> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>>
>> You need to add the package/classfile tree for you code.
>>
>> As you have: java:samplejena
>>
>> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
>> directory within /DIR.
>>
>> You then want:
>>
>> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>>
>> : is the classpath separator.
>>
>>      Andy
>>
>> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>>
>>> Hello,
>>>
>>> I have attached the file with the change, i am getting Could not find or
>>> load main class arq.arq
>>>
>>> My classpath location is /home/ak/Documents. Please let me know whether
>>> my change is correct.
>>>
>>> Regards,
>>> Arun
>>>
>>>
>>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org <mailto:
>>> andy@apache.org>> wrote:
>>>
>>>      Hi - Please send email to the jena users mailing list.
>>>
>>>      (It is correct if it works!)
>>>
>>>           Andy
>>>
>>
>>
> 

Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
So my JENA_CP
is JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*:/home/ak/Documents'.

/home/ak/Documents location has the classfile/jar of the code

But still when i run this command,

/home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
/home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq

I am getting the below error,

ak@akrish12:~$ /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
/home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
12:41:35 WARN  ClsLoader            :: Class not found:
samplejena.LastModified
12:41:35 WARN  exec                 :: URI <java:samplejena.LastModified>
has no registered function factory
-------------
| title | r |
=============
-------------


Regards,
Arun

On Tue, Aug 7, 2018 at 12:20 PM, Andy Seaborne <an...@apache.org> wrote:

> The list doesn't accept attachments.
>
> >> JENA_CP="$JENA_HOME"'/home/ak/Documents'
>
> This needs to be a valid java classpath.
>
> $JENA_HOME is directory of the Jena installation.
>
> In the original it says:
>
> JENA_CP="$JENA_HOME"'/lib/*'
>
> the .../lib/* (NB single quotes - no * expansion) puts all the jars in
> that direct on the classpath.
>
> For you:
>
> JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'
>
> You need to add the package/classfile tree for you code.
>
> As you have: java:samplejena
>
> Suppoose /DIR is the top of that directory tree so "samplejena"  is one
> directory within /DIR.
>
> You then want:
>
> JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'
>
> : is the classpath separator.
>
>     Andy
>
> On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
>
>> Hello,
>>
>> I have attached the file with the change, i am getting Could not find or
>> load main class arq.arq
>>
>> My classpath location is /home/ak/Documents. Please let me know whether
>> my change is correct.
>>
>> Regards,
>> Arun
>>
>>
>> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org <mailto:
>> andy@apache.org>> wrote:
>>
>>     Hi - Please send email to the jena users mailing list.
>>
>>     (It is correct if it works!)
>>
>>          Andy
>>
>
>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.
The list doesn't accept attachments.

 >> JENA_CP="$JENA_HOME"'/home/ak/Documents'

This needs to be a valid java classpath.

$JENA_HOME is directory of the Jena installation.

In the original it says:

JENA_CP="$JENA_HOME"'/lib/*'

the .../lib/* (NB single quotes - no * expansion) puts all the jars in 
that direct on the classpath.

For you:

JENA_CP='/home/ak/Downloads/apache-jena-3.8.0/lib/*'

You need to add the package/classfile tree for you code.

As you have: java:samplejena

Suppoose /DIR is the top of that directory tree so "samplejena"  is one 
directory within /DIR.

You then want:

JENA_CP='/home/afs/jlib/apache-jena/lib/*:/DIR'

: is the classpath separator.

     Andy

On 07/08/18 16:25, Arunkumar Krishnamoorthy wrote:
> Hello,
> 
> I have attached the file with the change, i am getting Could not find or 
> load main class arq.arq
> 
> My classpath location is /home/ak/Documents. Please let me know whether 
> my change is correct.
> 
> Regards,
> Arun
> 
> 
> On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <andy@apache.org 
> <ma...@apache.org>> wrote:
> 
>     Hi - Please send email to the jena users mailing list.
> 
>     (It is correct if it works!)
> 
>          Andy


Re: Writing an ARQ Extension Function

Posted by Arunkumar Krishnamoorthy <ak...@ncsu.edu>.
Hello,

I have attached the file with the change, i am getting Could not find or
load main class arq.arq

My classpath location is /home/ak/Documents. Please let me know whether my
change is correct.

Regards,
Arun


On Tue, Aug 7, 2018 at 11:11 AM, Andy Seaborne <an...@apache.org> wrote:

> Hi - Please send email to the jena users mailing list.
>
> (It is correct if it works!)
>
>     Andy
>
> On 07/08/18 14:59, Arunkumar Krishnamoorthy wrote:
>
>> Hello Andy,
>>
>> I have attached the file with the change, i am getting Could not find or
>> load main class arq.arq
>>
>> My classpath location is /home/ak/Documents. Please let me know whether
>> my change is correct.
>>
>> Regards,
>> Arun
>>
>> On Mon, Aug 6, 2018 at 5:08 PM, Andy Seaborne <andy@apache.org <mailto:
>> andy@apache.org>> wrote:
>>
>>
>>
>>     On 06/08/18 19:09, Arunkumar Krishnamoorthy wrote:
>>
>>         Hello All,
>>
>>         I am following the link below to write an ARQ extension function,
>>
>>         https://blog.ldodds.com/2005/11/07/writing-an-arq-extension-
>> function/
>>         <https://blog.ldodds.com/2005/11/07/writing-an-arq-extension
>> -function/>
>>
>>         Please find the query i have given,
>>
>>         PREFIX myfn: <java:samplejena.>
>>         PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#
>>         <http://www.w3.org/2000/01/rdf-schema#>>
>>         PREFIX dc: <http://purl.org/dc/elements/1.1/
>>         <http://purl.org/dc/elements/1.1/>>
>>         PREFIX xsd: <http://www.w3.org/2001/XMLSchema#
>>         <http://www.w3.org/2001/XMLSchema#>>
>>         SELECT ?title ?r
>>         WHERE {
>>         ?s rdfs:seeAlso ?r.
>>         OPTIONAL {?r dc:title ?title.}
>>         FILTER ( isURI(?r) &&
>>         myfn:LastModified(?r) >
>>         xsd:dateTime('2005-11-06T00:00:00Z') )
>>         }
>>
>>         And i execute the following command to run the query for the
>>         dataset,
>>
>>         /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
>>         /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>
>>         I am getting the error as,
>>
>>         *ak@akrish12:~$* /home/ak/Downloads/apache-jena-3.8.0/bin/arq
>> --data
>>         /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
>>
>>         14:07:07 WARN  ClsLoader            :: Class not found:
>>         samplejena.LastModified
>>         14:07:07 WARN  exec                 :: URI
>>         <java:samplejena.LastModified>
>>         has no registered function factory
>>         -------------
>>         | title | r |
>>         =============
>>         -------------
>>
>>         I have added the classpath in the location /home/ak/Documents
>>         and the jar
>>         of the file
>>         LastModified in the same location.
>>
>>         Could someone please help me to resolve this issue.
>>
>>
>>     The classapth is set in the "arq" script so take a copy and and edit
>>     it. Look for JENA_CP=
>>
>>
>>
>>
>>         Regards,
>>         Arun
>>
>>
>>

Re: Writing an ARQ Extension Function

Posted by Andy Seaborne <an...@apache.org>.

On 06/08/18 19:09, Arunkumar Krishnamoorthy wrote:
> Hello All,
> 
> I am following the link below to write an ARQ extension function,
> 
> https://blog.ldodds.com/2005/11/07/writing-an-arq-extension-function/
> 
> Please find the query i have given,
> 
> PREFIX myfn: <java:samplejena.>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> SELECT ?title ?r
> WHERE {
> ?s rdfs:seeAlso ?r.
> OPTIONAL {?r dc:title ?title.}
> FILTER ( isURI(?r) &&
> myfn:LastModified(?r) >
> xsd:dateTime('2005-11-06T00:00:00Z') )
> }
> 
> And i execute the following command to run the query for the dataset,
> 
> /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> 
> I am getting the error as,
> 
> *ak@akrish12:~$* /home/ak/Downloads/apache-jena-3.8.0/bin/arq --data
> /home/ak/Desktop/dataset.rdf --query /home/ak/Desktop/query.rq
> 
> 14:07:07 WARN  ClsLoader            :: Class not found:
> samplejena.LastModified
> 14:07:07 WARN  exec                 :: URI <java:samplejena.LastModified>
> has no registered function factory
> -------------
> | title | r |
> =============
> -------------
> 
> I have added the classpath in the location /home/ak/Documents and the jar
> of the file
> LastModified in the same location.
> 
> Could someone please help me to resolve this issue.

The classapth is set in the "arq" script so take a copy and and edit it. 
Look for JENA_CP=



> 
> Regards,
> Arun
>