File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,8 @@ class GraphPlugin {
7575 return ;
7676 }
7777
78- // Extract prefixes
79- const prefixMap = extractPrefixes ( this . yasr . results ) ;
78+ // Extract prefixes (pass both results and yasr instance)
79+ const prefixMap = extractPrefixes ( this . yasr ) ;
8080
8181 // Transform triples to graph data
8282 const { nodes, edges } = triplesToGraph ( triples , prefixMap ) ;
Original file line number Diff line number Diff line change 11/**
2- * Extract namespace prefixes from SPARQL results metadata
2+ * Extract namespace prefixes from SPARQL results metadata or YASR instance
33 * @param {Object } yasrResults - YASR results object
4+ * @param {Object } yasr - YASR instance (optional)
45 * @returns {Map<string, string> } Map of namespace URI to prefix
56 */
6- function extractPrefixes ( yasrResults ) {
7+ function extractPrefixes ( yasr ) {
78 const prefixMap = new Map ( ) ;
89
9- // Check for prefixes in results metadata
10- if ( yasrResults && yasrResults . getVariables ) {
11- const vars = yasrResults . getVariables ( ) ;
12- if ( vars && vars . prefixes ) {
13- Object . entries ( vars . prefixes ) . forEach ( ( [ prefix , uri ] ) => {
14- prefixMap . set ( uri , prefix ) ;
10+ // Try to get prefixes from YASR instance
11+ if ( yasr && yasr . getPrefixes ) {
12+ const prefixes = yasr . getPrefixes ( ) ;
13+ if ( prefixes && typeof prefixes === 'object' ) {
14+ Object . entries ( prefixes ) . forEach ( ( [ prefix , uri ] ) => {
15+ if ( uri && prefix ) {
16+ prefixMap . set ( uri , prefix ) ;
17+ }
1518 } ) ;
1619 }
17- }
20+ }
1821
1922 // Add common RDF prefixes as fallback
2023 const commonPrefixes = {
You can’t perform that action at this time.
0 commit comments