You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2018/02/24 08:30:40 UTC

[GitHub] jena pull request #366: JENA-1494: Reader properties

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/366

    JENA-1494: Reader properties

    Also includes:
    * Additional operations for RDFParser and RDFWriter
    * RDF/XML Writer properties example.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena reader-properties

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/366.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #366
    
----
commit 78903268f7e48ab6672a183b5db46eeff963e6ea
Author: Andy Seaborne <an...@...>
Date:   2018-02-24T08:23:29Z

    Add parse(Model) and parse(Dataset)

commit 6550960a23bc275762bf4540b27f77e8330f7981
Author: Andy Seaborne <an...@...>
Date:   2018-02-24T08:24:21Z

    Add source(Model) and source(Dataset)

commit 9237d24a99617c219ce9d4a4ab085621be3784d4
Author: Andy Seaborne <an...@...>
Date:   2018-02-24T08:25:02Z

    JENA-1494: ARP property setting from RIOT.

commit e9eb97fdfe7f9e3e738ff5fbac2f53ddee5c15ad
Author: Andy Seaborne <an...@...>
Date:   2018-02-24T08:25:51Z

    Examples RDF/XML handling.
    
    JENA-1168, JENA-1494.

commit 27771c3faf67634dc53287fb0d99ee37ef8befb2
Author: Andy Seaborne <an...@...>
Date:   2018-02-24T08:27:20Z

    Inline the example data. Consistent format.

----


---

[GitHub] jena pull request #366: JENA-1494: Reader properties

Posted by rvesse <gi...@git.apache.org>.
Github user rvesse commented on a diff in the pull request:

    https://github.com/apache/jena/pull/366#discussion_r170616197
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java ---
    @@ -50,14 +51,20 @@
         /**
          * Context key for old style RDFWriter properties. The value of this in a
          * {@link Context} must be a {@code Map<String, Object>}. The entries of the
    -     * map are used to set writer properties before the Jena legalacy
    +     * map are used to set writer properties before the Jena legacy
          * {@link RDFWriter} is called. Only has any effect on RDF/XML and
          * RDF/XML-ABBREV.
          */
    -
    -    /** Context key for old style RDFWriter properties */ 
         public static final Symbol sysRdfWriterProperties      = Symbol.create(riotBase+"rdfWriter_properties") ;
    -    
    +
    +    /**
    +     * Context key for old style RDFReader properties. The value of this in a
    +     * {@link Context} must be a {@code Map<String, Object>}. The entries of the
    +     * map are used to set reader properties before the Jena legalacy
    --- End diff --
    
    Typo - `legalacy`


---

[GitHub] jena pull request #366: JENA-1494: Reader properties

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/366#discussion_r170642885
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java ---
    @@ -116,17 +154,29 @@ public void parse() {
             arp.getHandlers().setErrorHandler(rslt) ;
             arp.getHandlers().setNamespaceHandler(rslt) ;
     
    +        // ARPOptions.
    +        ARPOptions arpOptions = arp.getOptions() ;
             if ( RiotUniformCompatibility ) {
    -            ARPOptions options = arp.getOptions() ;
                 // Convert some warnings to errors for compatible behaviour for all parsers.
                 for ( int code : additionalErrors )
    -                options.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ;
    -            arp.setOptionsWith(options) ;
    +                arpOptions.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ;
             }
             
             if ( JenaRuntime.isRDF11 )
                 arp.getOptions().setIRIFactory(IRIResolver.iriFactory());
     
    +        if ( context != null ) {
    +            try { 
    +                @SuppressWarnings("unchecked")
    +                Map<String, Object> p = (Map<String, Object>)(context.get(SysRIOT.sysRdfReaderProperties)) ;
    +                if ( p != null )
    +                    p.forEach((k,v) -> oneProperty(arpOptions, k, v)) ;
    +            } catch (Throwable ex) {
    +                Log.warn(AdapterRDFWriter.class, "Problem setting properties", ex);
    --- End diff --
    
    Will revise. The important item being covered is the class cast (maybe it should throw a meaningful exception?)  If `oneProperty` throws an exception, it can propagate as normal.


---

[GitHub] jena pull request #366: JENA-1494: Reader properties

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/366


---

[GitHub] jena pull request #366: JENA-1494: Reader properties

Posted by rvesse <gi...@git.apache.org>.
Github user rvesse commented on a diff in the pull request:

    https://github.com/apache/jena/pull/366#discussion_r170616897
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java ---
    @@ -116,17 +154,29 @@ public void parse() {
             arp.getHandlers().setErrorHandler(rslt) ;
             arp.getHandlers().setNamespaceHandler(rslt) ;
     
    +        // ARPOptions.
    +        ARPOptions arpOptions = arp.getOptions() ;
             if ( RiotUniformCompatibility ) {
    -            ARPOptions options = arp.getOptions() ;
                 // Convert some warnings to errors for compatible behaviour for all parsers.
                 for ( int code : additionalErrors )
    -                options.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ;
    -            arp.setOptionsWith(options) ;
    +                arpOptions.setErrorMode(code, ARPErrorNumbers.EM_ERROR) ;
             }
             
             if ( JenaRuntime.isRDF11 )
                 arp.getOptions().setIRIFactory(IRIResolver.iriFactory());
     
    +        if ( context != null ) {
    +            try { 
    +                @SuppressWarnings("unchecked")
    +                Map<String, Object> p = (Map<String, Object>)(context.get(SysRIOT.sysRdfReaderProperties)) ;
    +                if ( p != null )
    +                    p.forEach((k,v) -> oneProperty(arpOptions, k, v)) ;
    +            } catch (Throwable ex) {
    +                Log.warn(AdapterRDFWriter.class, "Problem setting properties", ex);
    --- End diff --
    
    Should this message more clearly state that some/all properties may have been ignored?


---