-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from IFB-ElixirFr/new-terms
v1.2.3 new terms button
- Loading branch information
Showing
20 changed files
with
1,135 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from metrics.AbstractFAIRMetrics import AbstractFAIRMetrics | ||
import validators | ||
from metrics.recommendation import json_rec | ||
|
||
|
||
class A12_Impl(AbstractFAIRMetrics): | ||
""" | ||
GOAL : retrieve embedded semantic annotations | ||
""" | ||
|
||
def __init__(self, web_resource=None): | ||
super().__init__(web_resource) | ||
self.name = "Authorisation procedure or access rights" | ||
self.id = "16" | ||
self.principle = "https://w3id.org/fair/principles/terms/A1.2" | ||
self.principle_tag = "A1.2" | ||
self.implem = "FAIR-Checker" | ||
self.desc = """ | ||
The protocol allows for an authentication and authorisation procedure where necessary. <br> | ||
FAIR-Checker verifies if access rights are specified in metadata through terms | ||
odrl:hasPolicy, dct:rights, dct:accessRights, or dct:license. | ||
""" | ||
|
||
def weak_evaluate(self): | ||
eval = self.get_evaluation() | ||
eval.set_implem(self.implem) | ||
eval.set_metrics(self.principle_tag) | ||
return eval | ||
|
||
def strong_evaluate(self): | ||
eval = self.get_evaluation() | ||
eval.set_implem(self.implem) | ||
eval.set_metrics(self.principle_tag) | ||
|
||
checked_properties = """ | ||
odrl:hasPolicy | ||
dct:rights | ||
dct:accessRights | ||
dct:license | ||
schema:license | ||
""" | ||
query_prov = ( | ||
self.COMMON_SPARQL_PREFIX | ||
+ """ | ||
ASK { | ||
VALUES ?p { """ | ||
+ checked_properties | ||
+ """ } . | ||
?s ?p ?o . | ||
} | ||
""" | ||
) | ||
|
||
eval.log_info( | ||
"Checking that at least one of the access policy properties is found in metadata:\n" | ||
+ checked_properties | ||
) | ||
res = self.get_web_resource().get_rdf().query(query_prov) | ||
for bool_res in res: | ||
if bool_res: | ||
eval.log_info( | ||
"At least one of the access policy properties was found in metadata !" | ||
) | ||
eval.set_score(2) | ||
return eval | ||
else: | ||
eval.log_info( | ||
"None of the access policy properties were found in metadata !" | ||
) | ||
eval.set_recommendations( | ||
json_rec["A12"]["reco1"] | ||
+ checked_properties | ||
+ """ | ||
""" | ||
) | ||
eval.set_score(0) | ||
return eval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.