-
Notifications
You must be signed in to change notification settings - Fork 18
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
<a> tag mapping to manage URL #fragment #1440
Conversation
|
I think I have to:
{
"knora-api:mappingHasName": "???",
"knora-api:attachedToProject": {
"@id": "???"
},
"rdfs:label": "???",
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
}
$ curl -u [email protected]:test -X POST -F [email protected] -F [email protected] http://localhost:3333/v2/mapping
PREFIX knora-base: <http://www.knora.org/ontology/knora-base#>
Construct {
?mapping ?p ?o .
?mapping knora-base:hasMappingElement ?mEle .
?mEle ?pp ?oo .
?oo ?ppp ?ooo .
}
WHERE {
BIND(<http://rdfh.ch/standoff/mappings/StandardMapping> as ?mapping)
?mapping ?p ?o .
OPTIONAL {
?mapping knora-base:hasMappingElement ?mEle .
OPTIONAL {
?mEle ?pp ?oo .
OPTIONAL {
?oo ?ppp ?ooo .
}
}
}
} To update this file |
I'm a little afraid of updating the ttl using a sparql query because of IRIs... maybe we should update the ttl by hand? :| And what about the upgrading of an existing Knora base? |
Yes, I think you have to add the new element to Maybe you can do this incrementally, otherwise the IRIs will be all different and every |
I am suffering from PTSD: posttraumatic standoff disorder myself .. |
@tobiasschweizer is there any tests to update? @tobiasschweizer @benjamingeer As you can see in this commit 380121a I have just to add few triplets to an existing Knora base to upgrade it. Is that correct for you? Any guide lines or I just try to copy/paste the way you are doing your upgrade scripts in |
You added an element to the existing mapping, so everything is expected to run as before (so the tests should pass). I think you should add a test that checks the new element. |
in which test file? (sorry, never used your test framework...) |
that would be |
Not very confortable with the CI failed, any clues? |
@tobiasschweizer It seems that an The cited value in the result is a |
I think this is because the mapping is returned as well at it contains more elements than before. |
…4d2cff was correct!)
I added a v1 test there using this data as input, but when I try to send the same data to the v2 API I get an error: {
"@type" : "anything:Thing",
"anything:hasRichtext" : {
"@type" : "knora-api:TextValue",
"knora-api:textValueAsXml" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<text><p>ref to note <a class=\"internal-link\" href=\"#_note1\" id=\"_ref-note1\">[1]</a></p><p><a class=\"internal-link\" href=\"#_ref-note1\" id=\"_note1\">[1]</a> note 1</p></text>",
"knora-api:textValueHasMapping" : {
"@id" : "http://rdfh.ch/standoff/mappings/StandardMapping"
}
},
"knora-api:attachedToProject" : {
"@id" : "http://rdfh.ch/projects/0001"
},
"rdfs:label" : "test thing",
"@context" : {
"rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"knora-api" : "http://api.knora.org/ontology/knora-api/v2#",
"rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
"xsd" : "http://www.w3.org/2001/XMLSchema#",
"anything" : "http://0.0.0.0:3333/ontology/0001/anything/v2#"
}
} {
"knora-api:error": "org.knora.webapi.AssertionException: Resource <http://rdfh.ch/0001/JdZmxDDiSvi_OqU7I5Ur0g> was saved, but one or more of its values are not correct",
"@context": {
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
} @benjamingeer it sounds like an encoding problem? |
I'm going to try this test there |
Error is Update: not really reporduced because the errors are differents:
|
@benjamingeer my test above reveals an error described here #1221 (fixed here #1224) Don't know if it is related to my first error: |
Please see 41475fd. Does this make sense to you? |
I ran a v1 test to create the test data. |
OK but your test is in v2. It would make sense to test both cases. |
StandoffUtilV2 is used both in v2 and v1. Yes, I will try to produce tests data for v2 too. |
val originalId: String = standoffAssertions(value).getOrElse(OntologyConstants.KnoraBase.StandoffTagHasOriginalXMLID, throw InconsistentTriplestoreDataException(s"referred standoff $value node has no original XML id")) | ||
|
||
// If a v2 SPARQL template was used, the XML ID is in this standoff tag. | ||
val originalId: String = standoffTagAssertions.get(OntologyConstants.KnoraBase.TargetHasOriginalXMLID) match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is used for v2.
|
||
case None => | ||
// If a v1 SPARQL template was used, we have to get the target node and to get its XML ID. | ||
standoffAssertions(value).getOrElse(OntologyConstants.KnoraBase.StandoffTagHasOriginalXMLID, throw InconsistentTriplestoreDataException(s"referred standoff $value node has no original XML id")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is used for v1.
Ok I added tests for v1 and v2 in 40be041 Sorry, but I still don't understand the v2 case: Wouldn't |
Or are the pages of |
The method |
Ok, I understand! So v2 needs to read standoff in parts.
This the last day I can work on this before my holiday and I really try the best to be helpful. |
And I'm trying to be helpful by writing comments in the code so you can read them. :) |
Normally I would have. But today I just wanted to add that additional test ;-) You know how it is ... |
OK I think that should fix it, let's see if all the tests pass. |
great, thx. |
@tobiasschweizer Can we merge this now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gfoo Thanks for this PR!
That was a quick and easy one ;-)
@benjamingeer Yes, please go ahead. |
or as we say in Swiss German: "möööörtsch" |
@tobiasschweizer Thanks for your help, and have a good holiday! |
what a triplet team... ah ah ah :^) |
resolves #1346