You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2019/03/21 15:36:00 UTC

[jira] [Commented] (JENA-1687) Precise return types of NodeFactory methods

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

Andy Seaborne commented on JENA-1687:
-------------------------------------

Hi there - I don't understand the basic need here.  In what situations is casting happening? `Node` has "is*" and "get*" operations as well as a visitor pattern to dispatch on type.

The abstraction for RDFTerms is class `Node` - there might be different implementations of the subtypes. In the jena distribution code this isn't used - there is only `Var` in SPARQL is a subclass of `Node_Variable`. Teh visitor pattern is a way to dispatch on type. 

Why is casting (inc JENA-1688) beneficial? Note that rules and SPARQL actually work on ["generalised RDF"|https://www.w3.org/TR/rdf11-concepts/#section-generalized-rdf].

Jena has a large user base and preserving the investments in all the applications written using Jena is an important factor. Changes that might have impacts to existing code need to be made carefully.




> Precise return types of NodeFactory methods
> -------------------------------------------
>
>                 Key: JENA-1687
>                 URL: https://issues.apache.org/jira/browse/JENA-1687
>             Project: Apache Jena
>          Issue Type: Improvement
>            Reporter: Jan Martin Keil
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I propose to precise the return types of the NodeFactory methods, e.g. to set NodeFactory#createURI return type to Node_URI. This makes the developers life easier, as there is no longer a need to cast after creating a Node, if one need a specific node type. I can not see any disadvantages and it should be backward compatible (except of classes that override these methods).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)