@@ -47,7 +47,7 @@ private static void cjEdge2rdfModel(@Nullable Map<String, String> context, ICjEd
4747 List <ICjEndpoint > targets = cjEdge .targets ();
4848 List <ICjEndpoint > undirectedEndpoints = cjEdge .undirectedEndpoints ();
4949
50- String edgeType = cjEdge .type ();
50+ String edgeType = cjEdge .type () != null ? CjUris . expandId ( context , cjEdge . type ()) : null ;
5151
5252 if (endpoints .size () == 2 && sources .size () < 2 && targets .size () < 2 ) {
5353 // Order can be derived from endpoints
@@ -87,12 +87,12 @@ private static void cjEdge2rdfModel(@Nullable Map<String, String> context, ICjEd
8787 }
8888 ifPresentAccept (sourceEndpoint .type (), sssType -> {
8989 // Triple: (SSS, SSS_TYPE, TTT)
90- Property property = rdfModel .getProperty (sssType );
90+ Property property = rdfModel .getProperty (CjUris . expandId ( context , sssType ) );
9191 rdfModel .add (subject , property , object );
9292 });
9393 ifPresentAccept (targetEndpoint .type (), tttType -> {
9494 // Triple: (SSS, TTT_TYPE, TTT)
95- Property property = rdfModel .getProperty (tttType );
95+ Property property = rdfModel .getProperty (CjUris . expandId ( context , tttType ) );
9696 rdfModel .add (subject , property , object );
9797 });
9898
@@ -118,11 +118,11 @@ private static void cjEdge2rdfModel(@Nullable Map<String, String> context, ICjEd
118118 String predicateUri ;
119119 // Priority: endpoint type > edge type
120120 if (ep2 .type () != null ) {
121- predicateUri = ep2 .type ();
121+ predicateUri = CjUris . expandId ( context , ep2 .type () );
122122 } else if (ep1 .type () != null ) {
123- predicateUri = ep1 .type ();
123+ predicateUri = CjUris . expandId ( context , ep1 .type () );
124124 } else if (cjEdge .edgeType () != null ) {
125- predicateUri = cjEdge .type ();
125+ predicateUri = CjUris . expandId ( context , cjEdge .type () );
126126 } else {
127127 predicateUri = RdfCj .CjInRdf .IS_RELATED ;
128128 }
@@ -157,7 +157,7 @@ private static void cjNode2rdfModel(@Nullable Map<String, String> context, ICjNo
157157
158158 // Add node types
159159 cjNode .types ().forEach (cjType -> {
160- Resource typeResource = rdfModel .createResource (cjType .type ());
160+ Resource typeResource = rdfModel .createResource (CjUris . expandId ( context , cjType .type () ));
161161 rdfModel .add (rdfSubject , RDF .type , typeResource );
162162 });
163163
@@ -182,7 +182,7 @@ private static void cjNode2rdfModel(@Nullable Map<String, String> context, ICjNo
182182 if (value != null ) {
183183 if (value .isObject ()) {
184184 IJsonObject dataObject = value .asObject ();
185- jsonObject2rdfModel (rdfSubject , dataObject , rdfModel );
185+ jsonObject2rdfModel (context , rdfSubject , dataObject , rdfModel );
186186 }
187187 }
188188 });
@@ -207,7 +207,7 @@ private static ICjNode findNode(ICjDocument cjDoc, String nodeId) {
207207 return cjDoc .nodesAll ().filter (n -> nodeId .equals (n .id ())).findFirst ().orElse (null );
208208 }
209209
210- private static void jsonObject2rdfModel (Resource rdfSubject , IJsonObject dataObject , Model rdfModel ) {
210+ private static void jsonObject2rdfModel (@ Nullable Map < String , String > context , Resource rdfSubject , IJsonObject dataObject , Model rdfModel ) {
211211 boolean hasRdfData = false ;
212212
213213 // Check if there's an "rdf:data" object containing RDF property-value pairs
@@ -217,9 +217,9 @@ private static void jsonObject2rdfModel(Resource rdfSubject, IJsonObject dataObj
217217 hasRdfData = true ;
218218 IJsonObject rdfDataObject = rdfDataValue .asObject ();
219219 // Extract and emit RDF triples from the "rdf:data" object
220- for (String predicateUri : rdfDataObject .keys ()) {
221- Property predicate = rdfModel .createProperty (predicateUri );
222- IJsonValue value = rdfDataObject .get (predicateUri );
220+ for (String predicateId : rdfDataObject .keys ()) {
221+ Property predicate = rdfModel .createProperty (CjUris . expandId ( context , predicateId ) );
222+ IJsonValue value = rdfDataObject .get (predicateId );
223223
224224 toRdfLiterals (rdfModel , value , literal -> {
225225 rdfModel .add (rdfSubject , predicate , literal );
0 commit comments