-
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
refactor(api-v2): Use SparqlExtendedConstructResponse in ConstructResponseUtilV2 #1367
Conversation
@tobiasschweizer Issue #763 says to:
|
No, I don't think so. We do have a language property for text values (ISO language code) but it's not the same that is used for labels etc. in the ontology.
This was already done, yes. |
@benjamingeer I think I can review this PR next week. Would that be ok? |
Sure, no problem. Would you have time to look at #1259 with @andreas-aeschlimann this week? |
He said he would look at it. I will remind him :-) |
Thanks! |
The update script is needed in case someone created decimal values using v2, correct? |
Yes. |
webapi/src/main/scala/org/knora/webapi/responders/v2/SearchResponderV2.scala
Show resolved
Hide resolved
case (pred, obj) => | ||
pred == OntologyConstants.KnoraBase.IsMainResource && obj.toBoolean | ||
val subjectIsMainResource: Boolean = assertions.get(OntologyConstants.KnoraBase.IsMainResource.toSmartIri) match { | ||
case Some(objs) => objs.contains(BooleanLiteralV2(true)) |
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.
Couldn't you just check for the first element with headOption? There should be only one statement IsMainResource
.
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.
Yes, you‘re right.
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.
ok
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.
Done in 3d26cf3.
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.
I think it would make sense to add a basic test case for ConstructResponseUtilV2
. Do you think that is feasible?
webapi/src/main/scala/org/knora/webapi/util/ConstructResponseUtilV2.scala
Show resolved
Hide resolved
I could refactor |
Yes, no actual connection the triplestore is needed. Also we can get an idea how much time complex results need for processing (nested resources). |
Done in 3d26cf3.
We can't really see this now, because |
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.
That looks great, thanks!
Unfortunately, I am not able to test any of this locally (see #1370).
This PR improves type safety in
ConstructResponseUtilV2
by usingSparqlExtendedConstructResponse
, which provides the types returned by the triplestore.SparqlExtendedConstructResponse
to useSmartIri
for predicates.ConstructResponseUtilV2
and related classes.v2/generateInsertStatementsForValueContent.scala.txt
(wasxsd:valueHasDecimal
, should bexsd:decimal
).Resolves #763.