commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMMONSRDF-47) RDFSyntax should be interface, not enum
Date Thu, 09 Feb 2017 00:54:41 GMT

    [ https://issues.apache.org/jira/browse/COMMONSRDF-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15858795#comment-15858795
] 

ASF GitHub Bot commented on COMMONSRDF-47:
------------------------------------------

Github user stain commented on a diff in the pull request:

    https://github.com/apache/commons-rdf/pull/27#discussion_r100209281
  
    --- Diff: api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java ---
    @@ -91,7 +148,30 @@
          * Datasets</a>.
          */
         public boolean supportsDataset();
    +   
    +    /**
    +     * Return the RDF 1.1 serialization syntaxes.
    +     * <p>
    +     * This lists the W3C standardized RDF 1.1 syntaxes like {@link #TURTLE} and
    +     * {@link #JSONLD}. Note the existence of other RDF syntaxes that are not
    +     * included here, e.g. <a href="http://www.w3.org/TeamSubmission/n3/">N3</a>
and
    +     * <a href="https://en.wikipedia.org/wiki/TriX_%28syntax%29">TriX</a>.
    +     * <p>
    +     * The syntaxes returned only support the {@link #mediaType()}
    +     * and {@link #fileExtension()} as defined in the corresponding 
    +     * W3C specification.
    +     * 
    +     * @return
    +     *      A set of the official RDF 1.1 {@link RDFSyntax}es.
    +     * 
    +     * @see <a href="https://www.w3.org/TR/rdf11-primer/#section-graph-syntax">RDF
    +     *      1.1 Primer</a>
    +     * @see org.apache.commons.rdf.experimental.RDFParser
    +     */
     
    +    public static Set<RDFSyntax> w3cSyntaxes() {
    --- End diff --
    
    `W3CRDFSyntax` is package-protected. It was moved it out followingyour advice, but I don't
see any win in making it `public` as it has no additional methods (and shouldn't have).
    
    If we make it public and remove `w3cSyntaxes()` , then there's not much more any point
to have the proxy constants `RDFSyntax.TURTLE` etc. as they would also then be made public
at `W3CRDFSyntax.TURTLE` etc - which - not withstanding the CAPSISSUE - is not as accessible
for the 95% use cases of parsing/writing a RDF 1.1 syntax.
    



> RDFSyntax should be interface, not enum
> ---------------------------------------
>
>                 Key: COMMONSRDF-47
>                 URL: https://issues.apache.org/jira/browse/COMMONSRDF-47
>             Project: Apache Commons RDF
>          Issue Type: Bug
>          Components: api
>    Affects Versions: 0.2.0
>            Reporter: Stian Soiland-Reyes
>            Assignee: Stian Soiland-Reyes
>
> [~p_ansell] raises in [pull request 25|https://github.com/apache/incubator-commonsrdf/pull/25#discussion_r85231845]
> {quote}
> Using enum for RDFSyntax is a bad idea unless it overrides an interface and the interface
is used in method signatures instead of the enum. There are many other RDFSyntaxes, and enum
(without implementing an interface) is only suited to cases where the full set are known a
priori.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message