Skip to content

Commit bae6b00

Browse files
committed
WIP for #15
- Two new predicates in the RDF for LabCAS data collections - `urn:edrn:predicates:ownerPrincipal` - `urn:edrn:predicates:qaState` - Correction of some integration test data - Fix an error message - Fix a deprecated import message Note that the portal will need to understand these two new predicates.
1 parent 21b5e8c commit bae6b00

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/edrn.rdf/edrn/rdf/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ And now for the RDF::
806806
>>> graph = rdflib.Graph()
807807
>>> graph.parse(data=browser.contents)
808808
<Graph identifier=...(<class 'rdflib.graph.Graph'>)>
809-
>>> len(graph)
810-
9422
809+
>>> len(graph) > 9422
810+
True
811811
>>> subjects = frozenset([str(i) for i in graph.subjects() if str(i)])
812812
>>> subjects = list(subjects)
813813
>>> subjects.sort()

src/edrn.rdf/edrn/rdf/labcascollectionrdfgenerator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
_protocolPredicateURI = URIRef('urn:edrn:predicates:protocol')
2525
_collaborativeGroupPredicateURI = URIRef('urn:edrn:predicates:collaborativeGroup')
2626
_cardinalityPredicateURI = URIRef('urn:edrn:predicates:cardinality')
27+
_ownerPrincipal = URIRef('urn:edrn:predicates:ownerPrincipal')
28+
_qaState = URIRef('urn:edrn:predicates:qaState')
2729

2830
# Type URIs
2931
_statsTypeURI = URIRef('urn:edrn:types:labcas:statistics')
@@ -113,6 +115,13 @@ def generateGraph(self):
113115
group = _inconsistentCollaborativeGroupNaming.get(group)
114116
if group is not None:
115117
graph.add((subjectURI, _collaborativeGroupPredicateURI, Literal(group)))
118+
for owner in i.get('OwnerPrincipal', []):
119+
# Work around https://github.com/EDRN/EDRN-metadata/issues/63
120+
if owner.startswith('OwnerPrincipal='):
121+
owner = owner[15:]
122+
graph.add((subjectURI, _ownerPrincipal, Literal(owner)))
123+
for qaState in i.get('QAState', []):
124+
graph.add((subjectURI, _qaState, Literal(qaState)))
116125

117126
# And summary info
118127
graph.add((URIRef(context.labcasSolrURL + '/collections'), _cardinalityPredicateURI, Literal(str(numCollections))))

src/edrn.rdf/edrn/rdf/siterdfupdater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __call__(self):
3030
updater.updateRDF()
3131
self.count += 1
3232
except Exception as ex:
33-
_logger.exception('Failure updating RDF for "%s"', i.getPath())
33+
_logger.exception('Failure updating RDF for "%s"', '/'.join(source.getPhysicalPath()))
3434
self.failures.append(dict(title=i.Title, url=source.absolute_url(), message=str(ex)))
3535
self.numFailed = len(self.failures)
3636
return self.render()

src/edrn.rdf/edrn/rdf/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def parseTokens(s):
7777
# The ZPL 1.0 applies.
7878

7979
try:
80-
from zope.site.hooks import getSite
80+
from zope.component.hooks import getSite
8181
_get_default_context = getSite
8282
except ImportError:
8383
try:

0 commit comments

Comments
 (0)