-
Notifications
You must be signed in to change notification settings - Fork 6
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
MgdSchema object should support namespaced properties #107
Comments
This indeed solves the problem, but using those methods is a bit clunky. At least binding-level "magic" methods should be provided, so Other alternative is to use "sub-objects" for namespaces, like we do now with the metadata object. So then it'd be Though it should be noted that these ideas only work with the namespace prefix ( |
The second approach is better as it could fit to every GIR "bindings". Adding magic to PHP bindings is fine, but no forward compatible. |
I like it. So properties in So:
Is accessible via:
Using our existing conventions with Metadata object has the additional benefit that compatibility of "namespaced" properties is already solved with query building and views. For example, in a view:
(we should probably also reverse the usage of |
In practice, almost every application and developer uses namespaces instead of full URIs (or IRIs). For those, repository have to provide namespaceManager. Such is also proposed in MidgardCR API: Finally I think we should provide two solutions. Languages which do not allow to use variable as property name, one would call get_property_value(). |
Full URI/IRI support is important mainly for data exporters and importers, for example when Midgard Create needs to store RDF entities. |
One issue we need to consider: If A->ns is the same as B->ns, then both ns objects should have the same properties as they are instance of the same class. I also wonder if it makes sense to create GObject request feature so properties setter and getter could be more virtual. |
Tried to register properties with ':' and '_' and GObject transparently replaces these characters with dash.
is registered as foaf-person. This approach could be used as convention, however we do not know if it's going to be supported by GLib forever. Second issue is that you can not access property as obj.foaf-person as language parser might throw syntax error. So, if we could follow obj->ns->propertyname approach, we should be introspection safe, and provide nicer OOP. |
From Tim Janik: "Similar to C over C++, properties can be namespaced simply by convention. E.g. always prefix all property names with "foo-", like: foo-label, foo-visible, etc. " So this convention works with any Midgard version. |
On some languages properties with the |
With GIR you are not able to access properties directly, as every mgdschema type is not static. Object.get(name) or Object.get_property(name) should be used always, so |
At this moment 'ns-name' convention seems to be safest. |
Ability to read and write namespaced properties should be added to MidgardObject. As proposed in MidgardCR API: http://www.midgard-project.org/api-docs/midgard/core/unstable/midgard3/MidgardCR/MidgardCR.RepositoryObject.html.
Methods like:
should resolve the problem.
The text was updated successfully, but these errors were encountered: