On 06/12/13 12:08, Martynas Jusevičius wrote:
Thanks Andy. Yes looks like I have some upgrading to do...

Can you provide more info about that FileManager adapter and how it
works with OntDocumentManager?

AdapterFileManager extends FielManager.

(But the old FileManager still works albeit old world I/O)

Regarding static methods, I don't have a use case at hand, I was just
wondering if that's a good design decision. I'm always trying to leave
methods public and non-static, in case anyone needs to override them.

Pros and cons. RDFDataMgr makes simple/common I/O simple. You can set the complicated stuff if you want to.

RDFLanguages seems useful, I was missing this functionality in the
previous Jena version I used.
Is there some Jena exception that would be appropriate to throw when
RDFLanguages.contentTypeToLang() returns null? I.e. when the program
does not support reading/writing a certain media type?

Have you tried? :-)

        Andy


Martynas


On Fri, Dec 6, 2013 at 10:09 AM, Andy Seaborne <[email protected]> wrote:
On 06/12/13 00:21, Martynas Jusevičius wrote:

I was using SPIN API 1.3.0, I think it depends on ARQ 2.9.2. Now I
switched to SPIN API 1.3.1 that depends on Jena 2.11.0.


TopQuadrant only jump in large version steps so you may well find that many
small steps have become one large step for you.  Not a lot we can do about
that.


I found the Lang class - there seems to be some overlap in
functionality as well?


Lang is the constant symbols.  No statics.

RDFLanguages is the system registry.  You can add languages.


I also started looking at RDFDataMgr, to see wether it could replace
my DataManager (FileManager subclass) to do content negotiation and
stuff. FileManager did a poor job at conneg, that's true, but I think
RDFDataMgr is not a great solution either:
- RDFDataMgr is not a subclass of FileManager, so it cannot be used
with OntDocumentManager?


There is a FileManager adapter that is installed.


- why static methods? Cannot override :(


What do you want to override?


- is it possible to specify qualified media types for content
negotiation? I mean different "q" values for different media types in
the "Accept" header. I have an example that does that (which I'm now
upgrading to Jena's new classes):


The conneg accept headers are:

text/turtle,application/n-triples;q=0.9,application/rdf+xml;q=0.8,application/xml;q=0.7,*/*;q=0.5

application/trig,application/n-quads;q=0.9,text/x-nquads;q=0.8,application/x-trig;q=0.7,*/*;q=0.5

text/turtle,application/n-triples;q=0.9,application/rdf+xml;q=0.8,application/xml;q=0.7,application/trig,application/n-quads;q=0.9,text/x-nquads;q=0.8,application/x-trig;q=0.7,*/*;q=0.5

or add your own org.apache.jena.riot.stream.Locator.


https://github.com/Graphity/graphity-browser/blob/master/src/main/java/org/graphity/client/locator/LocatorLinkedData.java


Locators still exist, albeit rewritten.

Fixed


- was a separate class necessary at all, if conneg can be handled by a
Locator, as the example above shows?


RDFDataMgr is not just about conneg.

All the non-XML based readers and writer have been rewritten.

Systematic handing of triples and quads.

model.read(url) does full conneg.

RDFDataMgr is the "one stop shop" for I/O.


The JavaDoc states that "RDFDataMgr superceeds the FileManager" - but
it doesn't look like it can be simply used as a replacement?


No.


http://jena.apache.org/documentation/io/rdf-input.html#example-2-using-the-rdfdatamgr


and a few lines lower down:
http://jena.apache.org/documentation/io/rdf-input.html#streammanager-and-locationmapper


Martynas


You could submit a patch.

         Andy



On Fri, Dec 6, 2013 at 1:01 AM, Andy Seaborne <[email protected]> wrote:

Which version were you using?

org.apache.jena.riot.WebContent
WebContent.contentTypeToLang

but better:

RDFLanguages.contentTypeToLang(String)

and use constants not Strings.

          Andy


On 05/12/13 22:57, Martynas Jusevičius wrote:


Or rather, what functionality can replace langFromContentType() that I
was using to convert media type to Jena syntax name:

       String syntax = langFromContentType(in.getMimeType());
       model.read(in.getInput(), filenameOrURI, syntax);


       public static String langFromContentType(String mimeType)
       {
           if ( mimeType == null )
               return null ;
           return LANGS.get(mimeType.toLowerCase()) ;
       }

      public static final Map<String, String> LANGS = new HashMap<>() ;
       static
       {
           LANGS.put(WebContent.contentTypeRDFXML,
WebContent.langRDFXML);
LANGS.put(WebContent.contentTypeTurtle, WebContent.langTurtle);
         // snip
       }


Martynas

On Thu, Dec 5, 2013 at 11:45 PM, Martynas Jusevičius
<[email protected]> wrote:


Hey,

I'm using constants from org.openjena.riot.WebContent, such as
WebContent.contentTypeRDFXML, WebContent.langRDFXML etc.

After upgrading to Jena 2.11.0 (as part of SPIN API 1.3.1), the
WebContent class is not there anymore. What can I use instead?

Thanks.

Martynas





Reply via email to