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

Add support for editing labels and value comments #261

Merged
merged 33 commits into from
Oct 25, 2016
Merged

Conversation

tobiasschweizer
Copy link
Contributor

@tobiasschweizer tobiasschweizer commented Sep 14, 2016

This adds:

  • Support for viewing and editing resource labels in SALSAH.
  • Support for querying, editing, and deleting value comments.
  • Support for property predicate inheritance in the ontology responder, which was missing from Redesign the ontology responder for better performance #252.
  • The ability for a resource class to be a subclass of something that isn't a resource class, e.g. foaf:Person.
  • The ability for a Knora resource property to be a subproperty of something that isn't a resource property, e.g. foaf:name.
  • GUI support for knora-base:UriValue and knora-base:BooleanValue.
  • Sorting property definitions by guiorder in the API response describing a resource type, so they're sorted that way in the form for creating a new resource.

It also fixes these GUI bugs:

  • When creating a new resource, if you clicked on the red X buttons to remove optional properties, invalid JSON was submitted.
  • It was possible to select knora-base:Region as the type of resource to be created, but this didn't make sense.
  • There was a button for adding a value for the property knora-base:hasStandoffLinkto, but users shouldn't be able to do that.

Closes #271.
Closes #263.

@tobiasschweizer tobiasschweizer added enhancement improve existing code or new feature frontend (salsah) labels Sep 14, 2016
@tobiasschweizer tobiasschweizer added this to the Beta Release milestone Sep 14, 2016
Tobias Schweizer added 2 commits September 14, 2016 16:17
…ng a label

- TODO: reset does not work properly yet. Editing is still active.
@benjamingeer benjamingeer changed the title Wip/labels Add support for editing labels Sep 14, 2016
@tobiasschweizer
Copy link
Contributor Author

This is it, I have to add the named graph to the update query:

WITH <http://www.knora.org/data/incunabula>
DELETE ...

I can get the resource's project from the resinfo query and find out the named graph like this

@tobiasschweizer
Copy link
Contributor Author

I wanted to use this in the update query's where clause:

?resource rdf:type ?resourceClass ;
            knora-base:isDeleted false .
    ?resourceClass rdfs:subClassOf+ knora-base:Resource .

But with the statement ?resourceClass rdfs:subClassOf+ knora-base:Resource ., the update takes no effect in fuseki.

@benjamingeer
Copy link

That's correct. The DELETE and INSERT clauses have to specify the named graph, or you can use WITH, which covers the whole update. You can look at some of the other update queries for examples.

@benjamingeer
Copy link

The second problem is because you're using WITH. The class knora-base:Resource isn't defined in the Incunabula named graph, so your WHERE clause can't see it. Instead of using WITH, specify the named graph using GRAPH in the DELETE and WHERE clauses.

@benjamingeer
Copy link

While you're at it, you could make the same change to changeComment.scala.txt, which doesn't check the resource class and uses WITH.

- remove resource class check from update query's where clause (because it is in the knora-base named graph)
@tobiasschweizer
Copy link
Contributor Author

tobiasschweizer commented Sep 15, 2016

Actually I have just removed the resource class check from the where clause in the update (the check is included in resinfo and later in the label update check) since it requires two named graphs: the one the resource is in and knora-base.

Or could I specify the named graph only in the DELETE and INSERT using GRAPH?

specify the named graph using GRAPH in the DELETE and WHERE clauses

Did you mean INSERT instead of WHERE?

If so, I can adapt the label update as well as the comment later today.

@benjamingeer
Copy link

Yes, sorry, I meant INSERT instead of WHERE. Look at how it's done in the other update queries. They all say DELETE { GRAPH <...> { ... } } INSERT { GRAPH <...> { ... } } WHERE { ... }. Only the DELETE and INSERT clauses have GRAPH, not the WHERE clause.

@tobiasschweizer
Copy link
Contributor Author

tobiasschweizer commented Sep 15, 2016

fdfd984

I also checked that resource is not marked as deleted in changeComment.scala.txt. I assume that only values of resources that are not marked as deleted can be changed.

By the way: If I remember correctly we do not mark values as deleted when you mark the resource as deleted. So we should check the resource's deletion state whenever an update is requested for a value. Right or am I mistaken?

@benjamingeer
Copy link

By the way: If I remember correctly we do not mark values as deleted when you mark the resource as deleted. So we should check the resource's deletion state whenever an update is requested for a value. Right or am I mistaken?

You're right. We do check, except in changeFileValueV1. I've assigned the issue to you: #272. :)

@benjamingeer
Copy link

This is ready to review, @tobiasschweizer can you have a look?

@tobiasschweizer
Copy link
Contributor Author

with great pleasure, but tomorrow

- Sort property definitions by guiorder in the API response describing a resource type.

- Don't display an add button for knora-base:hasStandoffLinkto.

- Try to display the label on a region (not working yet).
@benjamingeer
Copy link

We couldn't figure out how to get the label to display on a region. So far we traced the problem to this code at the end of jquery.propedit.js:

        var prop_index = 0;
        return this.each(function() {
            var prop = $(this).data('propname');
            // console.log(prop);
            reset_field(prop, prop_index, options.readonly);
            prop_index++;
        });

Here prop is never __label__, but we couldn't figure out why. It seems that $(this).data is constructed differently for a page and for a region, but we don't see how.

Benjamin Geer added 5 commits October 11, 2016 16:46
…284) (in progress)

- Display labels on regions.
- If there is no comment on a value, return a JSON null in the API.
- Add a route 'valuecomments' with an HTTP delete method for deleting a comment.
@benjamingeer
Copy link

We are fixing some comment editing bugs on this branch.

The main remaining problem is that when you edit a comment, the GUI doesn't reset the value with the IRI of the new value version. This needs to be fixed in jquery.propedit.js (see the comment on line 139) and in jquery.valcomment.js.

@tobiasschweizer
Copy link
Contributor Author

Next week, we should adapt the browser tests so they pass.

The problem was that we hadn't any sorting of the properties in the GUI so far (GUI order). Now, as long as they GUI order is not changed, this should behave in a consistent manner.

Benjamin Geer added 3 commits October 24, 2016 15:33
# Conflicts:
#	docs/latex/knora-base/knora-base.pdf
#	docs/latex/knora-base/knora-base.tex
- Fix value responder test of comment editing.

- Add missing SALSAH icons.
@benjamingeer benjamingeer changed the title Add support for editing labels Add support for editing labels and value comments Oct 24, 2016
@benjamingeer benjamingeer merged commit 2c1c32e into develop Oct 25, 2016
@benjamingeer benjamingeer deleted the wip/labels branch October 25, 2016 15:05
SepidehAlassi added a commit that referenced this pull request Oct 31, 2016
…ip/beol

* 'develop' of https://github.com/dhlab-basel/Knora:
  Update README.md
  test (webapi): add E2E testing (#244)
  BEOL and bibliography ontologies (#283)
  refactor (webapi): migrate spray to akka http (#273)
  fix (sipi error message): display the error message returned by SIPI (#287)
  Add support for editing labels and value comments (#261)
  docs: Convert Knora base ontology doc to RST. (#289)
  relative paths (#288)
  removing relative paths to icons in css file: it doesn't survive an front apache proxy like: (#191)
  adding css and fonts used in the js/jquery.editvalue.js (#180)
  docs: Add remark about pyvenv for anaconda users on mac and linux (#264)
  add internal link to doc/readme (#278)
  docs (extended search): add missing explanations for LIKE and !LIKE (#279)
  Upgrade the built-in Fuseki to version 2.4.0 (#268)

# Conflicts:
#	knora-ontologies/knora-base.ttl
#	webapi/src/test/scala/org/knora/webapi/responders/v1/OntologyResponderV1Spec.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working enhancement improve existing code or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Salsah - all created resource hold a label="test" Salsah - the image selector is gone
4 participants