You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by Gautham Shankar <ga...@gmail.com> on 2015/02/14 01:44:28 UTC

Problems that i ran into using Apache SIS

Hy,

I am newbie to Apache SIS,

Below are the issues that i ran into
========================================

1.The  link below contains an example on how to use the command line
interface,however the link used to extract metadata throws 400,kindly
provide a valid one.(the link is now apparantly fixed my Professor Mattman)

*http://sis.apache.org/command-line.html
<http://sis.apache.org/command-line.html>*

2.Tried running the sis-console.jar after building the source using maven

*F:\sis_source\apache-sis-0.5-src\sis-0.5\application\sis-console\target>java
-ja*
*r sis-console-0.5.jar*
*--------------------------------------------------------------*
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/sis/util/l
ogging/MonolineFormatter
        at org.apache.sis.console.Command.main(Command.java:230)
Caused by: java.lang.ClassNotFoundException:
org.apache.sis.util.logging.Monolin
eFormatter
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

3.Also i found this link provided my Proffesor Mattman was very useful to
run the sis.jar on windows which could be updated on the Apache SIS WIKI

http://svn.apache.org/repos/asf/sis/trunk/application/sis-console/src/main/artifact/README

Kindlt correct me if i was wrong.

Regards
Gautham

Re: Problems that i ran into using Apache SIS

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Gautham

Le 22/02/15 03:33, Gautham Gowrishankar a écrit :
> However the API doc describes the asMap() method returning a
> HashMap<String,Object>.I need help in identifying the Object returned
> by each key which would aid me in using theier setter() and getter()
> methods.

For any AbstractMetadata object, you can get the types with the
following code:

    AbstractMetadata metadata = ...,
    MetadataStandard standard = metadata.getStandard();
    Map<String,Class<?>> standard.asTypeMap(metadata.getClass(), KeyNamePolicy.UML_IDENTIFIER, TypeValuePolicy.ELEMENT_TYPE);

The TypeValuePolicy argument controls which kind of information you want
when the property is a collection. For example if a property type is
Collection<Citation>, then:

  * With TypeValuePolicy.PROPERTY_TYPE, you get Collection.class.
  * With TypeValuePolicy.ELEMENT_TYPE, you get Citation.class.

By the way, the MetadataStandard class also give you other methods like
asValueMap(...), which is the same as the asMap() method that you
already used but giving more control for example on what to return when
the property is null or empty. There is also asNameMap(...) if you need
to perform some mapping between the ISO 19115 names and the JavaBeans
names, or asInformationMap(...) for information like a sentence
summarizing the metadata, and whether a value is mandatory or not.

    Martin



Re: Problems that i ran into using Apache SIS

Posted by Gautham Gowrishankar <go...@usc.edu>.
Hy,

I was able to extract the MetaData  using the asMap() method of
defaultMetaData Object
=============================

Map<String,Object> hashMap= defaultMetadata.asMap();

========================

I am able to print the key Value pairs as below

------------------------

characterSets
[UTF-8]

contacts
[Responsible party
  ├─Role……………………… Resource provider
  └─Party
      └─Name…………… UCAR/NCAR - CISL - ACADIS
]

......


However the API doc describes the  asMap() method returning a
HashMap<String,Object>.I need help in identifying the Object returned
by each key which would aid me in using theier setter() and getter()
methods.

Kindly let me know where i could get the list of Objects in the Map,I
could identify *Citation* as one of them.

Regards

Gautham


On Sat, Feb 14, 2015 at 1:54 PM, Gautham Gowrishankar <go...@usc.edu>
wrote:

> Cool, Sounds Good !!!
>
> Will try this out,this makes my life a lot easier :)
> Will keep you posted
>
> Regards
> Gautham
>
> On Sat, Feb 14, 2015 at 1:51 PM, Martin Desruisseaux <
> martin.desruisseaux@geomatys.fr> wrote:
>
>> Hello Gautham
>>
>> Great that it worked!
>>
>> For reading metadata: if the goal is to read metadata not only from XML
>> document, but also from other sources (currently only NetCDF), then I
>> would suggest the following:
>>
>> import org.apache.sis.storage.DataStore;
>> import org.apache.sis.storage.DataStores;
>>
>> ...
>>
>>     try (DataStore ds = DataStores.open(input)) {
>>         Metadata md = ds.getMetadata();
>>     }
>>
>>
>> where 'input' can be a File, URI or any other type documented there:
>>
>>
>>
>> http://sis.apache.org/apidocs/org/apache/sis/storage/DataStores.html#open-java.lang.Object-
>>
>> Once you have the Metadata object, the getter methods allow to fetch
>> various information (or just do a System.out.println(md) to see what is
>> there). The "Aggregation hierarchy" column in the table in the following
>> page may be useful:
>>
>>
>> http://sis.apache.org/apidocs/org/apache/sis/metadata/iso/package-summary.html
>>
>>     Martin
>>
>>
>>
>> Le 14/02/15 21:31, Gautham Gowrishankar a écrit :
>> > Hello Martin,
>> >
>> > Could you guide me as to which classes would i have look into since i
>> need
>> > to extract MetaData.
>> > I am basically trying to build a .iso19139 parser for Tika using Apache
>> SIS.
>> >
>> > I am trying look into the Java API doc for the MetaData Package,but i
>> need
>> > a starting  point as to how files are read in  Apache SIS.
>> > The Test Cases looks a little vague for me.
>> >
>> > Regards
>> > Gautham
>>
>>
>

Re: Problems that i ran into using Apache SIS

Posted by Gautham Gowrishankar <go...@usc.edu>.
Cool, Sounds Good !!!

Will try this out,this makes my life a lot easier :)
Will keep you posted

Regards
Gautham

On Sat, Feb 14, 2015 at 1:51 PM, Martin Desruisseaux <
martin.desruisseaux@geomatys.fr> wrote:

> Hello Gautham
>
> Great that it worked!
>
> For reading metadata: if the goal is to read metadata not only from XML
> document, but also from other sources (currently only NetCDF), then I
> would suggest the following:
>
> import org.apache.sis.storage.DataStore;
> import org.apache.sis.storage.DataStores;
>
> ...
>
>     try (DataStore ds = DataStores.open(input)) {
>         Metadata md = ds.getMetadata();
>     }
>
>
> where 'input' can be a File, URI or any other type documented there:
>
>
>
> http://sis.apache.org/apidocs/org/apache/sis/storage/DataStores.html#open-java.lang.Object-
>
> Once you have the Metadata object, the getter methods allow to fetch
> various information (or just do a System.out.println(md) to see what is
> there). The "Aggregation hierarchy" column in the table in the following
> page may be useful:
>
>
> http://sis.apache.org/apidocs/org/apache/sis/metadata/iso/package-summary.html
>
>     Martin
>
>
>
> Le 14/02/15 21:31, Gautham Gowrishankar a écrit :
> > Hello Martin,
> >
> > Could you guide me as to which classes would i have look into since i
> need
> > to extract MetaData.
> > I am basically trying to build a .iso19139 parser for Tika using Apache
> SIS.
> >
> > I am trying look into the Java API doc for the MetaData Package,but i
> need
> > a starting  point as to how files are read in  Apache SIS.
> > The Test Cases looks a little vague for me.
> >
> > Regards
> > Gautham
>
>

Re: Problems that i ran into using Apache SIS

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Gautham

Great that it worked!

For reading metadata: if the goal is to read metadata not only from XML
document, but also from other sources (currently only NetCDF), then I
would suggest the following:

import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStores;

...

    try (DataStore ds = DataStores.open(input)) {
        Metadata md = ds.getMetadata();
    }


where 'input' can be a File, URI or any other type documented there:

   
http://sis.apache.org/apidocs/org/apache/sis/storage/DataStores.html#open-java.lang.Object-

Once you have the Metadata object, the getter methods allow to fetch
various information (or just do a System.out.println(md) to see what is
there). The "Aggregation hierarchy" column in the table in the following
page may be useful:

http://sis.apache.org/apidocs/org/apache/sis/metadata/iso/package-summary.html

    Martin



Le 14/02/15 21:31, Gautham Gowrishankar a écrit :
> Hello Martin,
>
> Could you guide me as to which classes would i have look into since i need
> to extract MetaData.
> I am basically trying to build a .iso19139 parser for Tika using Apache SIS.
>
> I am trying look into the Java API doc for the MetaData Package,but i need
> a starting  point as to how files are read in  Apache SIS.
> The Test Cases looks a little vague for me.
>
> Regards
> Gautham


Re: Problems that i ran into using Apache SIS

Posted by Gautham Gowrishankar <go...@usc.edu>.
Hello Martin,

Could you guide me as to which classes would i have look into since i need
to extract MetaData.
I am basically trying to build a .iso19139 parser for Tika using Apache SIS.

I am trying look into the Java API doc for the MetaData Package,but i need
a starting  point as to how files are read in  Apache SIS.
The Test Cases looks a little vague for me.

Regards
Gautham

On Sat, Feb 14, 2015 at 12:04 PM, Gautham Gowrishankar <go...@usc.edu>
wrote:

> Hello  Martin,
>
> That works...in extracting the sis.jar from the source .
> Thank you !!!
>
> Regards
> Gautham
>
> On Fri, Feb 13, 2015 at 5:23 PM, Martin Desruisseaux <
> martin.desruisseaux@geomatys.fr> wrote:
>
>> Hello Gautham
>>
>> Welcome :-)
>>
>>
>> Le 14/02/15 01:44, Gautham Shankar a écrit :
>> > 2.Tried running the sis-console.jar after building the source using
>> maven
>> >
>> >
>> F:\sis_source\apache-sis-0.5-src\sis-0.5\application\sis-console\target>java
>> -jar sis-console-0.5.jar
>> > *--------------------------------------------------------------*
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > org/apache/sis/util/logging/MonolineFormatter
>>
>> The reason is that the Apache SIS project is divided in many modules.
>> The "sis-console.jar" file is only the very last one in the chain; it
>> needs other modules for its working. There is different way to fix the
>> problems (e.g. run with Maven, use Maven "assembly", etc.). Would you
>> mind trying the following one?
>>
>> After a successful build, execute the following command:
>>
>> mvn org.apache.sis.core:sis-build-helper:dist --non-recursive
>>
>> It should create the following file:
>>
>> target/distribution/apache-sis-0.5.zip
>>
>> Just unzip this file in any directory you like. If you were on a Unix
>> system, you could run directly the "bin/sis" executable. But on Windows,
>> we did not yet had volunter for writing a ".bat" file. You would have to
>> unpack the file manually:
>>
>> unpack200 --remove-pack-file lib/sis.pack.gz lib/sis.jar
>>
>> Then you should be able to execute directly that lib/sis.jar file, as it
>> contains all needed dependencies in a single file. Please let me know if
>> you encounter any issue.
>>
>>
>> > 3.Also i found this link provided my Proffesor Mattman was very useful
>> to
>> > run the sis.jar on windows which could be updated on the Apache SIS WIKI
>> >
>> >
>> http://svn.apache.org/repos/asf/sis/trunk/application/sis-console/src/main/artifact/README
>>
>> Yes, you should find the same README file (with only different version
>> number) in the above-cited ZIP file. It could be use for completing the
>> wiki, if there is any volunter for taking care of the wiki?
>>
>>     Regards,
>>
>>         Martin
>>
>>
>

Re: Problems that i ran into using Apache SIS

Posted by Gautham Gowrishankar <go...@usc.edu>.
Hello  Martin,

That works...in extracting the sis.jar from the source .
Thank you !!!

Regards
Gautham

On Fri, Feb 13, 2015 at 5:23 PM, Martin Desruisseaux <
martin.desruisseaux@geomatys.fr> wrote:

> Hello Gautham
>
> Welcome :-)
>
>
> Le 14/02/15 01:44, Gautham Shankar a écrit :
> > 2.Tried running the sis-console.jar after building the source using maven
> >
> >
> F:\sis_source\apache-sis-0.5-src\sis-0.5\application\sis-console\target>java
> -jar sis-console-0.5.jar
> > *--------------------------------------------------------------*
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/sis/util/logging/MonolineFormatter
>
> The reason is that the Apache SIS project is divided in many modules.
> The "sis-console.jar" file is only the very last one in the chain; it
> needs other modules for its working. There is different way to fix the
> problems (e.g. run with Maven, use Maven "assembly", etc.). Would you
> mind trying the following one?
>
> After a successful build, execute the following command:
>
> mvn org.apache.sis.core:sis-build-helper:dist --non-recursive
>
> It should create the following file:
>
> target/distribution/apache-sis-0.5.zip
>
> Just unzip this file in any directory you like. If you were on a Unix
> system, you could run directly the "bin/sis" executable. But on Windows,
> we did not yet had volunter for writing a ".bat" file. You would have to
> unpack the file manually:
>
> unpack200 --remove-pack-file lib/sis.pack.gz lib/sis.jar
>
> Then you should be able to execute directly that lib/sis.jar file, as it
> contains all needed dependencies in a single file. Please let me know if
> you encounter any issue.
>
>
> > 3.Also i found this link provided my Proffesor Mattman was very useful to
> > run the sis.jar on windows which could be updated on the Apache SIS WIKI
> >
> >
> http://svn.apache.org/repos/asf/sis/trunk/application/sis-console/src/main/artifact/README
>
> Yes, you should find the same README file (with only different version
> number) in the above-cited ZIP file. It could be use for completing the
> wiki, if there is any volunter for taking care of the wiki?
>
>     Regards,
>
>         Martin
>
>

Re: Problems that i ran into using Apache SIS

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Gautham

Welcome :-)


Le 14/02/15 01:44, Gautham Shankar a écrit :
> 2.Tried running the sis-console.jar after building the source using maven
>
> F:\sis_source\apache-sis-0.5-src\sis-0.5\application\sis-console\target>java -jar sis-console-0.5.jar
> *--------------------------------------------------------------*
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/sis/util/logging/MonolineFormatter

The reason is that the Apache SIS project is divided in many modules.
The "sis-console.jar" file is only the very last one in the chain; it
needs other modules for its working. There is different way to fix the
problems (e.g. run with Maven, use Maven "assembly", etc.). Would you
mind trying the following one?

After a successful build, execute the following command:

mvn org.apache.sis.core:sis-build-helper:dist --non-recursive

It should create the following file:

target/distribution/apache-sis-0.5.zip

Just unzip this file in any directory you like. If you were on a Unix
system, you could run directly the "bin/sis" executable. But on Windows,
we did not yet had volunter for writing a ".bat" file. You would have to
unpack the file manually:

unpack200 --remove-pack-file lib/sis.pack.gz lib/sis.jar

Then you should be able to execute directly that lib/sis.jar file, as it
contains all needed dependencies in a single file. Please let me know if
you encounter any issue.


> 3.Also i found this link provided my Proffesor Mattman was very useful to
> run the sis.jar on windows which could be updated on the Apache SIS WIKI
>
> http://svn.apache.org/repos/asf/sis/trunk/application/sis-console/src/main/artifact/README

Yes, you should find the same README file (with only different version
number) in the above-cited ZIP file. It could be use for completing the
wiki, if there is any volunter for taking care of the wiki?

    Regards,

        Martin