Closed (fixed)
Project:
RDF Extensions
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
26 Mar 2011 at 19:16 UTC
Updated:
22 Jun 2011 at 21:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedI'm a good way into coding this, so marking as mine.
Comment #2
Anonymous (not verified) commentedThis patch adds an overview of all mappings.
This is a dirty patch, it includes the patch from http://drupal.org/node/1106662#comment-4268006 so that you can see the overview. You actually have to type in /mapping at the end of the URL, though, to see the page.
Some things to consider:
Comment #3
scor commentedI think it might be good to just stick with a read only listing at first. I'm thinking that building a UI for editing *any* RDF mapping would be a nice thing to have (editing not only the Field mapping but any attribute in an entity such as comment_count like we do in core with the RDF mapping API), but this could be added at a later stage with an overlay on top of that overview list for example.
Comment #4
Anonymous (not verified) commentedI'm attaching a screenshot for discussion purposes.
In looking at this, I think it might be clearer if the 'Fields' and 'Other Template Variables' were both set to that light grey and all other rows had white backgrounds.
I'm fine with sticking to the read-only at first.
Comment #5
scor commentedI'm wondering if part of this code could be used for #1053928: Port site vocabulary functionality to Drupal 7, the site vocabulary is the same idea, except it's in RDF. Later we might be able to add RDFa to this page too :)
Comment #6
Anonymous (not verified) commentedI guess some of the iterative code that gets all the fields for a bundle could be used... other than that, I'm not seeing where the overlap is, but I haven't worked on that like you have so I could be missing something obvious.
Currently this page is only shown to admins with RDF mapping premissions. I think it would only make sense to use RDF if we have a non-admin version. I think it does make sense to offer that, though, and we could reuse the code from this display. I think that it would have to be displayed at a different path, though.
If it is a standard page at a standard URI on all Drupal sites with this module enabled, we might even add some VoID about the site and make it an easy access point for those who want to know more about what data is exposed. This could actually be extremely useful, particularly for those trying to access data from other sites (say, using SPARQL Views).
If we can figure this out quickly, I'd love to have it coded for this weekend's Drupal Gov Days. I'm not going, but I know there will be a few talks about Linked Data stuff. I can dedicate time to working on this.
Comment #7
Anonymous (not verified) commentedThere could also be an interface that would generate export code for entities so that they could be automatically added as SPARQL Views resources on another site.
This would mean it would be as simple as pressing that button and importing the types you want, and then you could have immediate Views access to that external Drupal site... this sounds pretty rad to me!
Comment #8
scor commentedyes, it would have to be a non-admin path behind a permission. I was only thinking out loud here, not sure how much of an overlap there is. after thinking about this a bit more, there might not be enough overlap. The overlap is loading all entity types info and all fields info and foreaching them (only a few lines of code). The site vocabulary would display more data such as range, domain, field constraints, which might overload an "overview of all mappings for all bundles". I certainly do not want to block this issue because of that, so let's move this aspect in #1053928: Port site vocabulary functionality to Drupal 7, and keep the "overview of all mappings for all bundles" page simple for now.
Comment #9
dan7 commentedhi,
i'm not sure how much functional schould be your patch, but for example when i try to edit RDF type or any Field of "Taxonomy term" it
shows an error >
Notice: Trying to get property of non-object in rdfui_admin_rdf_overview_form() (line 164 of C:\My_programs\wamp_real\wamp\www\drupal-7.0\sites\all\modules\rdf\modules\rdfui\rdfui.module).
is this behavior expected ?
Dan
Comment #10
scor commentedthanks for testing this @dan7. It looks like the taxonomy issue you're experiencing is the same as #905340: RDF UI doesn't work when mapping Taxonomy.
Comment #11
scor commentedthis will need to be rerolled to take the commit from #1106662: Provide all RDF configuration options in one section in Configuration into account.
Comment #12
Anonymous (not verified) commentedRerolled with a small fix to make the mappings overview the MENU_DEFAULT_LOCAL_TASK...
Would it be better if there were a listing of all the tabs on the first page?
Comment #13
milesw commented@linclark: This is looking great. Good call on the vertical tabs for entity types, I think it works quite well.
Yes, a listing page does seem necessary. It's awkward if you come through Configuration -> RDF publishing settings and hit the big mappings overview table. I'm going to try and put together a patch that includes a listing page, along with some other adjustments I have in mind.
Comment #14
Anonymous (not verified) commentedThanks for checking it out, Miles :) Here is another one with just the Fields and Other Template Variables headers shaded.
After looking through the other config pages, it turns out only two others use tabs (in core, at least), and neither of those two have an overview list. While I think that it is not optimal to have the entire RDF Mapping overview on the page, I'm tempted to follow convention. In this case, convention would mean we have a default local task, and I think that RDF Mapping Overview is a better default task than RDF Namespaces.
Perhaps there is another RDF config page we need, and if there is maybe it would be better as the default. Anyone have thoughts on other config pages we may need?
Comment #15
Anonymous (not verified) commentedGah! Here is the patch.
Comment #16
milesw commented@linclark: Yeah, looking at this again, a listing page could just get annoying. A good rule of thumb seems to be ordering sub-pages (local tasks) by usage frequency. I can imagine the RDF mappings overview being very frequently accessed. Even if another RDF config page becomes necessary, I have a feeling the mappings page will still be the priority under RDF Publishing.
This patch reworks the formatting of tables on the mappings overview. The screenshot shows how they look. Some other changes include...
- Adding some hook_help text
- Added fragment IDs to 'edit' operation links so they open vertical tabs in the mapping UI
- Minor change to the namespaces page to get rid of E_STRICT warning
- Made some text more concise
Comment #17
milesw commentedJust noticed that edit links for Comment don't work properly and should probably be removed. I'll wait to hear some thoughts before rolling another patch.
Comment #18
milesw commented...that patch included a bunch of whitespace which Git does not appreciate. Here's a new one without the whitespace.
Comment #19
Anonymous (not verified) commentedSome really nice improvements in there. For those watching at home, it also:
I like the new table structure, I think it is much clearer. However, I think that making the distinction between Fields and Other Template Variables is important. Fields can be added by the user and have RDFa output automatically. OTVs can only be added by a dev or themer and require their own RDFa handling. This confuses people like Earl Miles who couldn't figure out how the node template variables got their mappings, so I dont' think we want to conflate the two. What do you think? If you agree, then we could just put those headers back in there (and probably change the striping).
BTW, Miles, would you mind moving the namespace changes to another patch? We don't necessarily need another issue, but I'd like to keep the commits distinct (just to appease the version control angel on my shoulder).
Looking good!
Comment #20
milesw commentedSorry, I was being lazy with the namespace changes. I'll break those changes out into a new patch
Any ideas on how we could distinguish between Fields and Other Template Variables without adding labels inside the table? I really like how clean and easy to read it is without the labels. Another possibility is splitting them into two separate tables.
Do you have any links that might help to understand OTVs? Are they basically anything that is not a true Field API field? The term "template variables" seems misleading here. To me it suggests attributes only used for theme templates.
Comment #21
milesw commentedOops, didn't mean to change the status. Must have been because I still had the issue open in the browser.
This is the same as before, except changes to the namespace admin are broken out. If there is a better way to do it, please fill me in. I'm still getting the feel for version control.
Comment #22
Anonymous (not verified) commentedUnfortunately, there is nothing that really documents the other template variables.
Basically, they are things that are added to $node by other modules using hooks. For instance, the user module adds the author's name and picture with hook_node_load. These are not actually registered as field values, so they are magic variables as far as the node object is concerned... they don't go through hook_preprocess_field, which is where the RDFa wrapper is set.
For the most part, users will be interacting with RDFa for fields. Advanced users could potentially figure out how to wrap magic variables in RDFa, but the focus of the work is on fields, which are generalizable. However, because in the particular instance of nodes the template variables are mapped and wrapped with RDFa by core, we want to display these in the table... and eventually add a UI for changing these mappings as well.
I think that splitting them into two tables would be somewhat confusing because we are using separate tables for separate bundles of an entity.
In the spirit of brainstorming, two ideas that are most likely really bad:
Comment #23
milesw commentedThanks for clarifying things a bit, I've still got a lot to understand about how the pieces fit together. I'm glad you took care of all the logic for displaying these mappings. :)
Originally I made that first column heading "Fields and Attributes" and later changed it to "Fields". My thinking was that it's usually pretty obvious which items are fields added via Field UI or another module, and which items are special. Having 'real' fields sit at the top of the table definitely helps differentiate them.
I'm not so convinced we need to label the two different types of mappings. The label "Other Template Variables" may even cause extra confusion. If the concern is that people will question why those mappings are not editable, then we could address that in the help text at the top, maybe pointing to further documentation.
If you really think the labels are necessary, the rowspan idea might work. Relying on row striping seems risky because custom themes can look entirely different. What about adding a very short note in the operations column?
Comment #24
scor commentedComment #25
milesw commentedRe-rolled patch from #21
Comment #26
scor commentedLike I said in the call, "template variables" is not the right term for data which is available in entities independently from the theming layer (even if they get themed in template preprocess for the HTML rendereing). Entity API calls them "properties". Although that might be misleading for RDF people, we generally use the term "predicate" in the RDF mapping UI, so maybe that would not be a problem for non-RDF people (the majority of our users). Alternate terminology: attributes, metadata. Any other idea?
Comment #27
Anonymous (not verified) commentedSo you are talking about this comment, correct? We need a better description of why a separate process is required for these variables.
Powered by Dreditor.
Comment #28
scor commentedI'm referring to the label "Other Template Variables" in the screenshot of #14. From the discussion we had today, there might not be such a label in this table after all, but I'm sure defining a terminology for "non-field fields" will be useful anyways for other places in the UI.
Comment #29
Anonymous (not verified) commentedWe'll be going with something more like the screenshot in #16, I believe.
I thought we decided not to explain the non-field field distinction in the UI but would leave it for documentation? That is, that there would be a link to a page on Drupal.org that explains that there are field predicates (and that RDFa for those get added automatically) and then there are these non-field predicates (and that you need to do special work to add those in the RDFa).
If you agree with that, I think that for the most part that discussion would be another issue. The only part in this patch that I think would be affected is the comment I posted and the one below... and possibly we'd want to come up with a better variable name than $fake_fields for the array of "template variables", but I think that variable name works for now.
Powered by Dreditor.
Comment #30
scor commentedyes, #16 and #29 look good.
Comment #31
Anonymous (not verified) commentedI've created the other issue at #1174436: Document the difference between Field API fields and fake fields
I will try to rework the comment and will post a revised version of Miles's patch.
Comment #32
Anonymous (not verified) commentedFirst comment changed to:
Second comment changed to:
Comment #33
scor commentedpatching file rdfx.module
Hunk #1 succeeded at 58 with fuzz 2.
Hunk #2 FAILED at 104.
Comment #34
Anonymous (not verified) commentedOk, this one should apply.
Comment #35
scor commentedThis looks great!
Only minor points: There seems to be no ordering in the list of vertical tabs and the field names, the order seems random. IMO, it should either be consistent with the "manage fields" tab (with fake fields place last in alpha order), or all in alpha order.
How about offering a tooltip with the full URIs for CURIEs, or a link altogether?
Comment #36
Anonymous (not verified) commentedTalked with scor about it over Skype, we agreed that we could commit this and move the two comments to their own issue.
So... fixed with b4cb304! Thanks miles for the UI insight.