Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metadata
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
libraries
Metadata
Commits
ed94c7cd
Commit
ed94c7cd
authored
Nov 23, 2022
by
Benedikt Heinrichs
Browse files
Options
Downloads
Patches
Plain Diff
Simplify Query
parent
17f11a62
No related branches found
No related tags found
1 merge request
!59
Fix: Deal with other organizations
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Metadata/RdfStoreConnector.cs
+13
-21
13 additions, 21 deletions
src/Metadata/RdfStoreConnector.cs
with
13 additions
and
21 deletions
src/Metadata/RdfStoreConnector.cs
+
13
−
21
View file @
ed94c7cd
...
@@ -420,44 +420,36 @@ namespace Coscine.Metadata
...
@@ -420,44 +420,36 @@ namespace Coscine.Metadata
return
triples
;
return
triples
;
}
}
public
IEnumerable
<
Triple
>
GetOrganizationByE
xternalOrE
ntityId
(
string
e
xternalOrE
ntityId
)
public
IEnumerable
<
Triple
>
GetOrganizationByEntityId
(
string
entityId
)
{
{
var
_query
String
=
new
SparqlParameterizedString
()
var
cmd
String
=
new
SparqlParameterizedString
()
{
{
CommandText
=
$@"
CommandText
=
$@"
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX org: <http://www.w3.org/ns/org#>
SELECT DISTINCT ?ror
SELECT DISTINCT ?ror
(rdfs:label AS ?p) ?name
WHERE
{{
WHERE
{{
?
ror
rdfs
:
label
?
name
.
?
ror
rdfs
:
label
?
name
.
{{
{{
SELECT
DISTINCT
?
ror
SELECT
DISTINCT
?
ror
WHERE
{{
WHERE
{{
?
class
?
p
?
memberUrl
;
?
ror
?
p
?
value
.
org
:
organization
?
ror
.
FILTER
(
?
value
IN
(
@entityId
))
{{
SELECT
DISTINCT
?
memberUrl
WHERE
{{
?
memberUrl
?
p
?
value
.
FILTER
(
?
value
IN
(
'
{
externalOrEntityId
}
'
))
}}
}}
}}
}}
}}
}}
}}
}}
"
"
};
};
using
var
results
=
QueryEndpoint
.
QueryWithResultSet
(
_queryString
.
ToString
()
);
cmdString
.
SetLiteral
(
"entityId"
,
entityId
);
if
(!
results
.
IsEmpty
)
{
using
var
resultSet
=
QueryEndpoint
.
QueryWithResultSet
(
cmdString
.
ToString
());
var
ror
=
results
.
Select
(
x
=>
x
.
Value
(
"ror"
).
ToString
());
// Get the value for ?ror
var
triples
=
new
List
<
Triple
>();
if
(
ror
.
Any
()
)
foreach
(
SparqlResult
r
in
resultSet
)
{
{
return
GetLabelForSubject
(
new
U
ri
(
ror
.
ToList
()[
0
]
));
triples
.
Add
(
new
T
ri
ple
(
r
.
Value
(
"ror"
),
r
.
Value
(
"p"
),
r
.
Value
(
"name"
)
));
}
}
}
return
triples
;
return
new
List
<
Triple
>();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment