Skip to content

Commit 918e38a

Browse files
committed
fixed problem with GC app type system report not showing properties, and not finding property names
1 parent 7940ca2 commit 918e38a

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

elmclient/_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def find_project(self, projectname_or_uri, include_archived=False):
155155
else:
156156
# must be a name
157157
projectu = self._projects.get(projectname_or_uri)
158-
print( f"{projectu=}" )
159158
if projectu is None:
160159
res = None
161160
else:
@@ -178,6 +177,7 @@ def report_type_system( self ):
178177
rows.append( [shortname,k,qcdetails[k]])
179178
# print in a nice table with equal length columns
180179
report += utils.print_in_html(rows,['Short Name', 'URI', 'Query Capability URI'])
180+
report += self.textreport()
181181

182182
rows = []
183183
for prefix in sorted(rdfxml.RDF_DEFAULT_PREFIX.keys()):

elmclient/_gcm.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _load_types(self,force=False):
131131
if sx:
132132
shapes_to_load = rdfxml.xml_find_elements(sx, './/oslc:resourceShape')
133133

134-
pbar = tqdm.tqdm(initial=0, total=len(shapes_to_load),smoothing=1,unit=" results",desc="Loading ETM shapes")
134+
pbar = tqdm.tqdm(initial=0, total=len(shapes_to_load),smoothing=1,unit=" results",desc="Loading GCM project shapes")
135135

136136
for el in shapes_to_load:
137137
self._load_type_from_resource_shape(el)
@@ -142,6 +142,7 @@ def _load_types(self,force=False):
142142
raise Exception( "services xml not found!" )
143143

144144
self.typesystem_loaded = True
145+
burp
145146
return None
146147

147148
# pick all the attributes from a resource shape definition
@@ -476,11 +477,9 @@ def _load_types(self,force=False):
476477
if not found:
477478
raise Exception( "No empty service provider found!" )
478479
sx = self.execute_get_rdf_xml( spurl, intent="Retrieve project/component service provider XML" )
479-
480480
if sx:
481481
shapes_to_load = rdfxml.xml_find_elements(sx, './/oslc:resourceShape' )
482-
483-
pbar = tqdm.tqdm(initial=0, total=len(shapes_to_load),smoothing=1,unit=" results",desc="Loading GCM shapes")
482+
pbar = tqdm.tqdm(initial=0, total=len(shapes_to_load),smoothing=1,unit=" results",desc="Loading GCM app shapes")
484483

485484
for el in shapes_to_load:
486485
self._load_type_from_resource_shape(el)
@@ -490,7 +489,6 @@ def _load_types(self,force=False):
490489

491490
else:
492491
raise Exception( "services xml not found!" )
493-
494492
return None
495493

496494
# pick all the attributes from a resource shape definition
@@ -613,7 +611,6 @@ def _generic_load_type_from_resource_shape(self, el, supershape=None):
613611
if self.is_known_property_uri( pd_u,shape_uri=uri,raiseifnotfound=False ):
614612
logger.debug( f"ALREADY KNOWN2" )
615613
continue
616-
617614
logger.info( f"Defining property {title}.{property_title} {altname=} {pd_u=} +++++++++++++++++++++++++++++++++++++++" )
618615
self.register_property(property_title,pd_u, shape_uri=uri, altname=altname)
619616
# check for any allowed value
@@ -699,3 +696,11 @@ def resolve_uri_to_name(self, uri, prefer_same_as=True, dontpreferhttprdfrui=Tru
699696
result = self.get_uri_name(uri)
700697
logger.info( f"Result {result=}" )
701698
return result
699+
700+
# for OSLC query, given an attribute (property) name return its type URI
701+
# the context is the shape definition - can be None, needed to be specified ultimately by the user when property names aren't unique
702+
def resolve_property_name_to_uri(self, name, shapeuri=None, exception_if_not_found=True):
703+
logger.info( f"resolve_property_name_to_uri {name=} {shapeuri=}" )
704+
result = self.get_property_uri(name,shape_uri=shapeuri)
705+
logger.info( f"resolve_property_name_to_uri {name=} {shapeuri=} {result=}" )
706+
return result

elmclient/examples/oslcquery.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ def do_oslc_query(inputargs=None):
410410
# ensure output folder exists
411411
args.typesystemreport = os.path.abspath(args.typesystemreport)
412412
outputpath = os.path.split(args.typesystemreport)[0]
413-
print( f"{outputpath=}" )
413+
# print( f"{outputpath=}" )
414414
if not os.path.isdir( outputpath ):
415-
print( f"creating {outputpath=}" )
415+
# print( f"creating {outputpath=}" )
416416
os.makedirs( outputpath, exist_ok=True)
417417

418418
open( args.typesystemreport, "wt").write( queryon.report_type_system() )
@@ -425,9 +425,9 @@ def do_oslc_query(inputargs=None):
425425
# ensure the output folder exists
426426
args.outputfile = os.path.abspath(args.outputfile)
427427
outputpath = os.path.split(args.outputfile)[0]
428-
print( f"{outputpath=}" )
428+
# print( f"{outputpath=}" )
429429
if not os.path.isdir( outputpath ):
430-
print( f"creating {outputpath=}" )
430+
# print( f"creating {outputpath=}" )
431431
os.makedirs( outputpath, exist_ok=True)
432432

433433
# erase the output file (also checks that it isn't open in Excel) before doing a possibly lengthy query :-)
@@ -590,9 +590,9 @@ def safeint(s,nonereturns=0):
590590
# ensure output folder exists
591591
args.xmloutputfile = os.path.abspath(args.xmloutputfile)
592592
outputpath = os.path.split(args.xmloutputfile)[0]
593-
print( f"{outputpath=}" )
593+
# print( f"{outputpath=}" )
594594
if not os.path.isdir( outputpath ):
595-
print( f"creating {outputpath=}" )
595+
# print( f"creating {outputpath=}" )
596596
os.makedirs( outputpath, exist_ok=True)
597597

598598
# basically for RM: retrieve all the result resources (as RDF-XML) and store to one file per resource

0 commit comments

Comments
 (0)