Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
25512340
Commit
25512340
authored
Sep 28, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Work around dropped categories _pdbx_item_linked_group_list and _pdbx_item_linked_group"
This reverts commit
71a46cd1
.
parent
d2d322ba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
8 deletions
+41
-8
.gitignore
+0
-2
include/cif++/CifValidator.hpp
+1
-0
src/Cif++.cpp
+1
-3
src/CifParser.cpp
+39
-3
No files found.
.gitignore
View file @
25512340
...
...
@@ -13,5 +13,3 @@ libcif++.la
config.status
config.log
libtool
version-info*.txt
rsrc/lib-version.txt
include/cif++/CifValidator.hpp
View file @
25512340
...
...
@@ -143,6 +143,7 @@ struct ValidateLink
std
::
vector
<
std
::
string
>
mParentKeys
;
std
::
string
mChildCategory
;
std
::
vector
<
std
::
string
>
mChildKeys
;
std
::
string
mLinkGroupLabel
;
};
// --------------------------------------------------------------------
...
...
src/Cif++.cpp
View file @
25512340
...
...
@@ -1676,8 +1676,6 @@ auto Category::erase(iterator pos) -> iterator
// a std::set of keys from one category is mapped to another.
// If all values in a child are the same as the specified parent ones
// the child is removed as well, recursively of course.
// --------------------------------------------------------------------
// update: the category is gone, so use the stored relations instead
if
(
mValidator
!=
nullptr
)
{
...
...
@@ -1956,7 +1954,7 @@ void Category::validateLinks() const
if
(
missing
)
{
std
::
cerr
<<
"Links for "
<<
linkValidator
->
m
ParentCategory
<<
"->"
<<
linkValidator
->
mChildCategory
<<
" are incomplete"
<<
std
::
endl
std
::
cerr
<<
"Links for "
<<
linkValidator
->
m
LinkGroupLabel
<<
" are incomplete"
<<
std
::
endl
<<
" There are "
<<
missing
<<
" items in "
<<
mName
<<
" that don't have matching parent items in "
<<
parent
->
mName
<<
std
::
endl
;
}
}
...
...
src/CifParser.cpp
View file @
25512340
...
...
@@ -892,10 +892,11 @@ void DictParser::linkItems()
std
::
map
<
std
::
tuple
<
std
::
string
,
std
::
string
,
int
>
,
size_t
>
linkIndex
;
std
::
vector
<
std
::
tuple
<
std
::
vector
<
std
::
string
>
,
std
::
vector
<
std
::
string
>>>
linkKeys
;
for
(
auto
li
:
mImpl
->
mLinkedItems
)
for
(
auto
gl
:
dict
[
"pdbx_item_linked_group_list"
]
)
{
std
::
string
child
,
parent
;
std
::
tie
(
child
,
parent
)
=
li
;
int
link_group_id
;
cif
::
tie
(
child
,
parent
,
link_group_id
)
=
gl
.
get
(
"child_name"
,
"parent_name"
,
"link_group_id"
);
auto
civ
=
mValidator
.
getValidatorForItem
(
child
);
if
(
civ
==
nullptr
)
...
...
@@ -905,7 +906,7 @@ void DictParser::linkItems()
if
(
piv
==
nullptr
)
error
(
"in pdbx_item_linked_group_list, item '"
+
parent
+
"' is not specified"
);
auto
key
=
std
::
make_tuple
(
piv
->
mCategory
->
mName
,
civ
->
mCategory
->
mName
,
0
);
auto
key
=
make_tuple
(
piv
->
mCategory
->
mName
,
civ
->
mCategory
->
mName
,
link_group_id
);
if
(
not
linkIndex
.
count
(
key
))
{
linkIndex
[
key
]
=
linkKeys
.
size
();
...
...
@@ -917,7 +918,35 @@ void DictParser::linkItems()
std
::
get
<
0
>
(
linkKeys
.
at
(
ix
)).
push_back
(
piv
->
mTag
);
std
::
get
<
1
>
(
linkKeys
.
at
(
ix
)).
push_back
(
civ
->
mTag
);
}
// for (auto li: mImpl->mLinkedItems)
// {
// std::string child, parent;
// std::tie(child, parent) = li;
//
// auto civ = mValidator.getValidatorForItem(child);
// if (civ == nullptr)
// error("in pdbx_item_linked_group_list, item '" + child + "' is not specified");
//
// auto piv = mValidator.getValidatorForItem(parent);
// if (piv == nullptr)
// error("in pdbx_item_linked_group_list, item '" + parent + "' is not specified");
//
// auto key = make_tuple(piv->mCategory->mName, civ->mCategory->mName, piv->mTag);
// if (not linkIndex.count(key))
// {
// linkIndex[key] = linkKeys.size();
// linkKeys.push_back({});
// }
//
// size_t ix = linkIndex.at(key);
// auto& keys = linkKeys.at(ix);
//
// keys.insert(civ->mTag);
// }
auto
&
linkedGroup
=
dict
[
"pdbx_item_linked_group"
];
// now store the links in the validator
for
(
auto
&
kv
:
linkIndex
)
{
...
...
@@ -926,6 +955,13 @@ void DictParser::linkItems()
std
::
tie
(
link
.
mParentKeys
,
link
.
mChildKeys
)
=
linkKeys
[
kv
.
second
];
// look up the label
for
(
auto
r
:
linkedGroup
.
find
(
cif
::
Key
(
"category_id"
)
==
link
.
mChildCategory
and
cif
::
Key
(
"link_group_id"
)
==
link
.
mLinkGroupID
))
{
link
.
mLinkGroupLabel
=
r
[
"label"
].
as
<
std
::
string
>
();
break
;
}
mValidator
.
addLinkValidator
(
std
::
move
(
link
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment