def __check_gp(self): gp_keys = r.keys('fragments:*:gp') for gpk in gp_keys: stored_gp = GraphPattern(r.smembers(gpk)) mapping = stored_gp.mapping(self._graph_pattern) if mapping: return gpk.split(':')[1], mapping return None
Copyright (C) 2015 Center for Open Middleware. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# """ from sdh.curator.actions.core.utils import GraphPattern __author__ = 'Fernando Serena' gp1 = GraphPattern() gp1.add('?a scm:hasBranch ?b') gp2 = GraphPattern() gp2.add('?s a scm:Repository') gp2.add('?s scm:hasBranch ?b') gp2.add('?b doap:name ?n') mapping = gp2.mapping(gp1) print mapping