Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RDMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
researchdata
RDMS
Commits
51bb0f4b
Commit
51bb0f4b
authored
2 years ago
by
Sagar
Browse files
Options
Downloads
Patches
Plain Diff
Remove complex identifier from complex relationship model
parent
930241f2
No related branches found
No related tags found
1 merge request
!24
Remove complex identifier from complex relationship model
Pipeline
#4454
failed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hyrax/app/models/concerns/complex_relation.rb
+0
-4
0 additions, 4 deletions
hyrax/app/models/concerns/complex_relation.rb
hyrax/spec/models/concerns/complex_relation_spec.rb
+7
-76
7 additions, 76 deletions
hyrax/spec/models/concerns/complex_relation_spec.rb
with
7 additions
and
80 deletions
hyrax/app/models/concerns/complex_relation.rb
+
0
−
4
View file @
51bb0f4b
...
...
@@ -4,10 +4,6 @@ class ComplexRelation < ActiveTriples::Resource
configure
type:
::
RDF
::
Vocab
::
PROV
.
Association
property
:title
,
predicate:
::
RDF
::
Vocab
::
DC
.
title
property
:url
,
predicate:
::
RDF
::
Vocab
::
MODS
.
locationUrl
property
:complex_identifier
,
predicate:
::
RDF
::
Vocab
::
MODS
.
identifierGroup
,
class_name
:"ComplexIdentifier"
accepts_nested_attributes_for
:complex_identifier
#property :relationship, predicate: ::RDF::Vocab::EBUCore.roleDefinition
property
:relationship
,
predicate:
::
RDF
::
Vocab
::
EBUCore
.
roleType
## Necessary to get AT to create hash URIs.
...
...
This diff is collapsed.
Click to expand it.
hyrax/spec/models/concerns/complex_relation_spec.rb
+
7
−
76
View file @
51bb0f4b
...
...
@@ -49,10 +49,6 @@ RSpec.describe ComplexRelation do
{
title:
'My first publication'
,
url:
'http://example.com/relation'
,
complex_identifier_attributes:
[{
identifier:
[
'123456'
],
label:
[
'local'
]
}],
relationship:
'IsPartOf'
}
]
...
...
@@ -60,9 +56,6 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
eq
[
'My first publication'
]
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
eq
[
'http://example.com/relation'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
identifier
).
to
eq
[
'123456'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
label
).
to
eq
[
'local'
]
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'IsPartOf'
]
end
...
...
@@ -90,7 +83,6 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
eq
[
'A relation title'
]
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'IsPartOf'
]
end
...
...
@@ -104,34 +96,13 @@ RSpec.describe ComplexRelation do
}
]
}
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
eq
[
'http://example.com/relation'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isPreviousVersionOf'
]
end
it
'creates a relation active triple resource with identifier and relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
complex_identifier_attributes:
[{
identifier:
[
'123456'
]
}],
relationship:
'isSupplementTo'
}
]
}
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
identifier
).
to
eq
[
'123456'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
label
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isSupplementTo'
]
end
it
'creates a relation active triple resource with title, url and relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
...
...
@@ -146,19 +117,15 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
eq
[
'A relation title'
]
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
eq
[
'http://example.com/relation'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isContinuedBy'
]
end
it
'creates a relation active triple resource with title
, identifier
and relationship'
do
it
'creates a relation active triple resource with title and relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
title:
'A relation title'
,
complex_identifier_attributes:
[{
identifier:
[
'123456'
]
}],
relationship:
'isContinuedBy'
}
]
...
...
@@ -166,23 +133,16 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
eq
[
'A relation title'
]
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
identifier
).
to
eq
[
'123456'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
label
).
to
be_empty
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isContinuedBy'
]
end
it
'creates a relation active triple resource with title, url
, identifier
and relationship'
do
it
'creates a relation active triple resource with title, url and relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
title:
'A relation title'
,
url:
'http://example.com/relation'
,
complex_identifier_attributes:
[{
identifier:
[
'123456'
],
label:
'Local'
}],
relationship:
'isDocumentedBy'
}
]
...
...
@@ -190,31 +150,21 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
title
).
to
eq
[
'A relation title'
]
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
eq
[
'http://example.com/relation'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
identifier
).
to
eq
[
'123456'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
label
).
to
eq
[
'Local'
]
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isDocumentedBy'
]
end
it
'creates a relation active triple resource with url
, identifier
and relationship'
do
it
'creates a relation active triple resource with url and relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
url:
'http://example.com/relation'
,
complex_identifier_attributes:
[{
identifier:
[
'123456'
],
label:
'Local'
}],
relationship:
'isDerivedFrom'
}
]
}
expect
(
@obj
.
complex_relation
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
url
).
to
eq
[
'http://example.com/relation'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
).
to
be_kind_of
ActiveTriples
::
Resource
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
identifier
).
to
eq
[
'123456'
]
expect
(
@obj
.
complex_relation
.
first
.
complex_identifier
.
first
.
label
).
to
eq
[
'Local'
]
expect
(
@obj
.
complex_relation
.
first
.
relationship
).
to
eq
[
'isDerivedFrom'
]
end
...
...
@@ -242,22 +192,7 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
).
to
be_empty
end
it
'rejects relation active triple with just identifier and no relationship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
complex_identifier_attributes:
[{
identifier:
[
'123456'
],
label:
'Local'
}],
}
]
}
expect
(
@obj
.
complex_relation
).
to
be_empty
end
it
'rejects relation active triple with just reltionship and no identifying information'
do
it
'rejects relation active triple with just relationship and no identifying information'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
...
...
@@ -269,17 +204,13 @@ RSpec.describe ComplexRelation do
expect
(
@obj
.
complex_relation
).
to
be_empty
end
it
'rejects relation active triple with no reltionship'
do
it
'rejects relation active triple with no rel
a
tionship'
do
@obj
=
ExampleWork2
.
new
@obj
.
attributes
=
{
complex_relation_attributes:
[
{
title:
'test relation'
,
url:
'http://example.com/relation'
,
complex_identifier_attributes:
[{
identifier:
[
'123456'
],
label:
'Local'
}]
url:
'http://example.com/relation'
}
]
}
...
...
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