Hi Rupert,

I'm not getting this to work on my new module (in the sandbox).

so I have my explanation bundle
and its pom.xml has the instruction

<Data-Files>
                            schemas,
                            schemas/registry
</Data-Files>

these directories exist in the explanation src/main/resources dir
and there is a file schemas/test.owl

Then I have a class in the same bundle. It references the datafile provider like this

    @Reference
    private DataFileProvider dataFileProvider;

Then in that class I do

Map<String,String> modelProperties = new HashMap<String,String>();
            modelProperties.put("Description", "Test ontology");
InputStream is = dataFileProvider.getInputStream(null, "test.owl",
                modelProperties);

and I'm getting IOExceptions and these log entries in a row

13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider Resource NOT found: test.owl 13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider Resource NOT found: test.owl 13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider Resource NOT found: test.owl

Why?

Alessandro


On 7/8/11 3:39 PM, Rupert Westenthaler wrote:
Hi

You can not retrieve URLs directly because the DataFileProvider
expects to load files.

The method used to lookup Resources is

     InputStream getInputStream(
             String bundleSymbolicName,
             String filename,
             Map<String, String>  comments) throws IOException;

for the 'bundleSymbolicName' you can parse null. It can be used to
ensure that the DataFile can only be loaded from the
MainDataFileProvider or from a DataFileProvider of the parsed
bundleSymbolicName.

This is the name of the file. You need to choose a way how to encode
the URL of an ontology to a fileName. I would not recommend you to
used paths, because users will not want to create sub-directories in
the /datafile directory. If a single configuration consists of several
files (e.g. a SolrIndex) than you should consider to use an archive
(ZIP, GZ ...).

The comments are currently used to provide additional information
about the requested file to the User. In future we might bind specific
functionality to some keys (e.g. A Button to download a required
resource if the "Download-Location" key is present and the value is an
valid URL)

The easiest way provide required datafiles to Stanbol is to include
those in a Bundle and to add the

     <Data-Files>
         {path}
     </Data-Files>

to the<instructions>  of the 'maven-bundle-plugin'.

     {path} it the path within the bundle to the folder containing the
DataFiles that need to be loaded. Multiple paths can be separated by
','

For a example you can have a look at the
"org.apache.stanbol.defaultdata" bundle.

best
Rupert Westenthaler

On Fri, Jul 8, 2011 at 3:14 PM, Alberto Musetti<[email protected]>  wrote:
Hi Rupert,
could you give me some information how to use datafileprovider to retrive URL 
resource and resolve the problem on ontologymanger integration-tests?

thanks
Alberto

Il giorno 08/lug/2011, alle ore 11.03, Alberto Musetti ha scritto:

Hi,

I work on it, thank you for reporting the problem.

best,
Alberto Musetti



Il giorno 08/lug/2011, alle ore 10.43, Rupert Westenthaler ha scritto:

Hi

Yesterday at the way home from Paris to Salzburg I noticed that the
integration tests of the ontologymanager [1] require remote services
and fail if one does not have an internet connection of if the remote
service is not available.

I think in an earlier discussion we agreed already that all unit and
integration tests are not allowed to depend on remote services but
must be executable in offline mode.

Can someone please adapt this tests accordingly? In the meantime I
suggest to disable them.

best
Rupert Westenthaler


[1] 
http://svn.apache.org/repos/asf/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/ontologymanager/web/it/
--
| Rupert Westenthaler             [email protected]
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen





--
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying 
morality, and so I am beyond caring."
(Col. Walter E. Kurtz)

Reply via email to