Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mention that factory is the only entry point to create new objects #82

Open
bergos opened this issue Aug 12, 2016 · 7 comments
Open

mention that factory is the only entry point to create new objects #82

bergos opened this issue Aug 12, 2016 · 7 comments

Comments

@bergos
Copy link
Member

bergos commented Aug 12, 2016

During a discussion about cloning terms with new values came up that it should be more clear that the factory is the only entry point to creates new objects. Maybe we should mention it in the spec.

@timbl
Copy link

timbl commented Aug 15, 2016

Not sure I understand the issue.
Lots of functions create new objects -- like take a string and convert it to a new Literal -- what is the point here?

@timbl
Copy link

timbl commented Aug 15, 2016

Do you mean duck typing is not allowed -- don't make up your own?

@RubenVerborgh
Copy link
Member

Having an “only entry point” seems a bit overspecified. The spec defines a common entry point all implementations should have, but each implementation should be free to have other entry points IMHO.

@blake-regalia
Copy link
Contributor

I support encouraging/requiring implementers to only create new Term objects from factory only - this does not mean they cannot use multiple secondary entry points which themselves invoke the factory's primary "entry point". I think the motivation is to ensure that stores can do all necessary indexing when new Terms are instantiated, especially when mixing libraries.

@niklasl
Copy link
Member

niklasl commented Aug 15, 2016

Is it expected that the evolution of the API will lead to more features of the terms themselves, such as Term.getPName() or perhaps even Node.getProperties() (the latter of which I'd probably advice against)? Or are terms simply thin value objects? If they are simple, I see little need for any value factory.

If they need access to at least prefix bindings, they should have a "store" member (or a "prefix manager"), or similar. That thing should also be a factory capable or producing instances. (I think this is more complex though. Also, indexing upon production of values isn't necessarily a good thing. For one, it might affect performance when doing basic format conversions.)

In Python's RDFLib, the terms themselves are (fairly) simple. High-level convenience access is provided through the Resource class. This combines the backing store and the identifier, enabling users to access the subjects, objects, prefixed names etc. I'm thinking something similar may be nice to build upon this API, and should inform these design decisions. (SimpleRDF comes to mind.)

Anyhow, we should strive for simplicity. Creating value objects directly seems more simple to me, to keeps things clearly separated.

@bergos
Copy link
Member Author

bergos commented Aug 15, 2016

Do you mean duck typing is not allowed

@timbl It's either the other way round, don't use instanceof always check the type of a term with .termType, so you can handle objects of other implementations.

...but each implementation should be free to have other entry points

@RubenVerborgh I see this as high level API feature. If there are new entry points, still the factory should be used internal. The comment of @blake-regalia describes the intention for it very well.

I see little need for any value factory.

@niklasl Without factory it's not possible to control which instance of objects an external library creates. If we would have only one reference implementation, that is used by everyone, than I would agree, but we will have more with different features. One will be better for streaming, the other one is better for fast in memory lookups and another one does a better job on embedded devices.

Maybe we should describe the concept and the need for the factory, not just it's "only entry point". Could be also part of a primer.

@blake-regalia
Copy link
Contributor

blake-regalia commented Oct 13, 2016

@bergos
The same goes for .datatype:
bergos/rdf-data-model-test-suite#4

@elf-pavlik elf-pavlik added this to the data-model-spec milestone Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants