parameters: (self)
docstring: Extract SHACL data shapes from the rdf graph.
  		<http://www.w3.org/ns/shacl#>
  
  		Instatiate the Shape Python objects and relate it to existing classes,
  		if available.
docstring_summary: Extract SHACL data shapes from the rdf graph.
  		<http://www.w3.org/ns/shacl#>
docstring_tokens: Extract SHACL data shapes from the rdf graph . <http : // www . w3 . org / ns / shacl# >
function: def build_shapes(self):
  		"""
  		Extract SHACL data shapes from the rdf graph.
  		<http://www.w3.org/ns/shacl#>
  
  		Instatiate the Shape Python objects and relate it to existing classes,
  		if available.
  		"""
  		self.all_shapes = [] 
  
  		qres = self.sparqlHelper.getShapes()
  
  		for candidate in qres:
  
  			test_existing_cl = self.get_shapes(uri=candidate[0])
  			if not test_existing_cl:
  				# create it
  				self.all_shapes += [OntoShape(candidate[0], None, 
  									self.namespaces, 
  									None, 
  									self.pref_title, 
  									self.pref_lang,)
  									]
  			else:
  				pass
  
  		# add more data
  		shacl = rdflib.Namespace('http://www.w3.org/ns/shacl#')
  
  		for aShape in self.all_shapes:
  
  			aShape.rdftype = shacl['Shape']
  			aShape.triples = self.sparqlHelper.entityTriples(aShape.uri)
  			aShape._buildGraph()  # force construction of mini graph
  
  			aShape.sparqlHelper = self.sparqlHelper
  
  			# attach to a class
  			for uri in aShape.getValuesForProperty(shacl['targetClass']):
  				aclass = self.get_class(str(uri))
  				if aclass:
  					aShape.targetClasses += [aclass]
  					aclass.all_shapes += [aShape]
  
  					#add shaped properties of this class. later can be used for ontodocs
  					for propertyUri in aShape.getValuesForProperty(shacl['path']): 
  						propType = self.get_property(str(propertyUri))
  						if propType:
  							aclass.shapedProperties += [{'shape': aShape, 'property': propType}]
  
  
  
  		# sort alphabetically
  		self.all_shapes = sorted(self.all_shapes, key=lambda x: x.qname)
  
  		# compute top layer
  		exit = []
  		for c in self.all_shapes:
  			if not c.parents():
  				exit += [c]
  		self.toplayer_shapes = exit
function_tokens: def build_shapes ( self ) : self . all_shapes = [ ] qres = self . sparqlHelper . getShapes ( ) for candidate in qres : test_existing_cl = self . get_shapes ( uri = candidate [ 0 ] ) if not test_existing_cl : # create it self . all_shapes += [ OntoShape ( candidate [ 0 ] , None , self . namespaces , None , self . pref_title , self . pref_lang , ) ] else : pass # add more data shacl = rdflib . Namespace ( 'http://www.w3.org/ns/shacl#' ) for aShape in self . all_shapes : aShape . rdftype = shacl [ 'Shape' ] aShape . triples = self . sparqlHelper . entityTriples ( aShape . uri ) aShape . _buildGraph ( ) # force construction of mini graph aShape . sparqlHelper = self . sparqlHelper # attach to a class for uri in aShape . getValuesForProperty ( shacl [ 'targetClass' ] ) : aclass = self . get_class ( str ( uri ) ) if aclass : aShape . targetClasses += [ aclass ] aclass . all_shapes += [ aShape ] #add shaped properties of this class. later can be used for ontodocs for propertyUri in aShape . getValuesForProperty ( shacl [ 'path' ] ) : propType = self . get_property ( str ( propertyUri ) ) if propType : aclass . shapedProperties += [ { 'shape' : aShape , 'property' : propType } ] # sort alphabetically self . all_shapes = sorted ( self . all_shapes , key = lambda x : x . qname ) # compute top layer exit = [ ] for c in self . all_shapes : if not c . parents ( ) : exit += [ c ] self . toplayer_shapes = exit