1 | package org.biohackathon.SPARQLBuilder.OWL;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 | import java.util.HashMap;
|
---|
5 |
|
---|
6 | import jp.riken.accc.db.rdf.crawler.dataStructure.sparql.JenaModelGenerator;
|
---|
7 | import jp.riken.accc.db.rdf.crawler.dataStructure.sparql.URICollection;
|
---|
8 |
|
---|
9 | import com.hp.hpl.jena.query.Query;
|
---|
10 | import com.hp.hpl.jena.query.QueryExecution;
|
---|
11 | import com.hp.hpl.jena.query.QueryExecutionFactory;
|
---|
12 | import com.hp.hpl.jena.query.QueryFactory;
|
---|
13 | import com.hp.hpl.jena.query.QuerySolution;
|
---|
14 | import com.hp.hpl.jena.query.ResultSet;
|
---|
15 | import com.hp.hpl.jena.rdf.model.Literal;
|
---|
16 | import com.hp.hpl.jena.rdf.model.Model;
|
---|
17 | import com.hp.hpl.jena.rdf.model.Property;
|
---|
18 | import com.hp.hpl.jena.rdf.model.Resource;
|
---|
19 |
|
---|
20 | //public class OWLQueryBuilderForCrawlerImpl implements OWLQueryBuilder {
|
---|
21 | public class AcquiredStructureAnalyzer implements RDFSchemaAnalyzer {
|
---|
22 |
|
---|
23 | private Model model = null;
|
---|
24 | private String endpointURI = null;
|
---|
25 | private String[] graphURIs = null;
|
---|
26 |
|
---|
27 | public String getEndpointURI(){
|
---|
28 | return endpointURI;
|
---|
29 | }
|
---|
30 |
|
---|
31 | public String[] getGraphURIs(){
|
---|
32 | return graphURIs;
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | public static void main(String[] args) throws Exception{
|
---|
37 |
|
---|
38 | JenaModelGenerator jmGene = new JenaModelGenerator("c:\\temp\\biosamplesF11.ttl");
|
---|
39 | // JenaModelGenerator jmGene = new JenaModelGenerator("c:\\temp\\reactomeF18s.ttl");
|
---|
40 | AcquiredStructureAnalyzer impl
|
---|
41 | = new AcquiredStructureAnalyzer(jmGene.getEndpointURI(), jmGene.getGraphURIs(), jmGene.getModel());
|
---|
42 |
|
---|
43 | System.out.println("--------------------------");
|
---|
44 | SClass[] scs = impl.getOWLClasses(null, null, null, true);
|
---|
45 | System.out.println("list classes:---------------");
|
---|
46 | for(SClass sc: scs){
|
---|
47 | System.out.println(sc.toString());
|
---|
48 | }
|
---|
49 | System.out.println("--------------------------");
|
---|
50 |
|
---|
51 | // ClassLink[] cls = impl.getNextClass(null,"http://www.biopax.org/release/biopax-level3.owl#Protein",100,true );
|
---|
52 | // for(ClassLink cl: cls){
|
---|
53 | // System.out.println(cl.toString());
|
---|
54 | // }
|
---|
55 | // System.out.println("--------------------------");
|
---|
56 |
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | public AcquiredStructureAnalyzer(String endpointURI, String[] graphURIs, Model model){
|
---|
61 | this.model = model;
|
---|
62 | this.endpointURI = endpointURI;
|
---|
63 | this.graphURIs = graphURIs;
|
---|
64 | }
|
---|
65 |
|
---|
66 | private String[] filterGraphURIs(String[] orgGraphURIs){
|
---|
67 | // TODO
|
---|
68 | return graphURIs;
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|
72 | public SClass[] listClasses(String[] graphURIs, boolean countInstances) throws Exception{
|
---|
73 | return getOWLClasses(graphURIs, null, null, countInstances);
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 | public SClass[] getOWLClasses(String[] graphURIs, String[] keywords, String language, boolean countInstances) throws Exception{
|
---|
80 | String[] targetGraphURIs = filterGraphURIs(graphURIs);
|
---|
81 |
|
---|
82 | StringBuffer queryStr = new StringBuffer();
|
---|
83 | queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n");
|
---|
84 | queryStr.append("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n");
|
---|
85 | queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n");
|
---|
86 | queryStr.append("SELECT DISTINCT ?c ?pLabel ?entities\n");
|
---|
87 | // if (targetGraphURIs != null) {
|
---|
88 | // for (String graphURI : targetGraphURIs) {
|
---|
89 | // queryStr.append("FROM <");
|
---|
90 | // queryStr.append(graphURI);
|
---|
91 | // queryStr.append(">\n");
|
---|
92 | // }
|
---|
93 | // }
|
---|
94 | queryStr.append("WHERE{\n");
|
---|
95 | queryStr.append(" ?cp <").append(URICollection.PROPERTY_VOID_CLASS).append("> ?c. \n");
|
---|
96 | queryStr.append(" ?cp <");
|
---|
97 | queryStr.append(URICollection.PROPERTY_VOID_ENTITIES);
|
---|
98 | queryStr.append("> ?entities. \n");
|
---|
99 | queryStr.append(" OPTIONAL{ ?c <");
|
---|
100 | queryStr.append(URICollection.PROPERTY_RDFS_LABEL);
|
---|
101 | queryStr.append("> ?pLabel. }\n");
|
---|
102 |
|
---|
103 | if (keywords != null && keywords.length != 0) {
|
---|
104 |
|
---|
105 | queryStr.append(" ?c rdfs:label ");
|
---|
106 | queryStr.append("?keywords").append(".\n");
|
---|
107 | queryStr.append(" filter((LANG(?keywords) = \'").append(language);
|
---|
108 | queryStr.append("\') && \n (");
|
---|
109 |
|
---|
110 | for (int i = 0; i < keywords.length; i++) {
|
---|
111 | if (i > 0)
|
---|
112 | queryStr.append(" || \n ");
|
---|
113 |
|
---|
114 | queryStr.append("regex(str(").append("?keywords")
|
---|
115 | .append("),\"");
|
---|
116 | queryStr.append(keywords[i]);
|
---|
117 | queryStr.append("\", \"i\" )");
|
---|
118 |
|
---|
119 | }
|
---|
120 | queryStr.append("))\n");
|
---|
121 |
|
---|
122 | }
|
---|
123 | queryStr.append("}");
|
---|
124 | System.out.println(queryStr.toString());
|
---|
125 |
|
---|
126 | Query query = QueryFactory.create(queryStr.toString());
|
---|
127 |
|
---|
128 | QueryExecution qexec = null;
|
---|
129 | ResultSet results = null;
|
---|
130 | try {
|
---|
131 | // long start = System.currentTimeMillis();
|
---|
132 | qexec = QueryExecutionFactory.create(query, model);
|
---|
133 | results = qexec.execSelect();
|
---|
134 | // long end = System.currentTimeMillis();
|
---|
135 | // System.out.println("EXEC TIME: " + (end - start));
|
---|
136 | } catch (Exception ex) {
|
---|
137 | ex.printStackTrace();
|
---|
138 | throw ex;
|
---|
139 | }
|
---|
140 |
|
---|
141 | HashMap<String, SClass> classMap = new HashMap<String, SClass>();
|
---|
142 | for (; results.hasNext();) {
|
---|
143 | QuerySolution sol = results.next();
|
---|
144 | Resource res = sol.getResource("c");
|
---|
145 | if (res != null && res.getURI() != null) {
|
---|
146 | String uri = res.getURI();
|
---|
147 | int numOfInstances = 0;
|
---|
148 | if (countInstances) {
|
---|
149 | numOfInstances = sol.getLiteral("entities").getInt();
|
---|
150 | } //
|
---|
151 | Literal labelLiteral = sol.getLiteral("pLabel");
|
---|
152 | SClass sClass = null;
|
---|
153 | if (classMap.containsKey(uri)) {
|
---|
154 | sClass = classMap.get(uri);
|
---|
155 | } else {
|
---|
156 | sClass = new SClass(uri, null, numOfInstances);
|
---|
157 | classMap.put(uri, sClass);
|
---|
158 | }
|
---|
159 | if (labelLiteral != null) {
|
---|
160 | String label = labelLiteral.getString();
|
---|
161 | String lang = labelLiteral.getLanguage();
|
---|
162 | sClass.addLabel(new Label(label, lang));
|
---|
163 | }
|
---|
164 | }
|
---|
165 | }
|
---|
166 | qexec.close();
|
---|
167 | return classMap.values().toArray(new SClass[0]);
|
---|
168 | }
|
---|
169 |
|
---|
170 | /*
|
---|
171 |
|
---|
172 | public Instance[] getInstances(String[] graphURIs, String keyword) throws Exception;
|
---|
173 | */
|
---|
174 |
|
---|
175 |
|
---|
176 | public ClassLink[] getNextClass(String[] graphURIs, String originClass, int limit, boolean countLinks) throws Exception{
|
---|
177 | String[] targetGraphURIs = filterGraphURIs(graphURIs);
|
---|
178 |
|
---|
179 | StringBuffer queryStr = new StringBuffer();
|
---|
180 | queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n");
|
---|
181 | queryStr.append("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n");
|
---|
182 | queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n");
|
---|
183 |
|
---|
184 | // SELECT
|
---|
185 | queryStr.append("SELECT DISTINCT ?indPropCat ?c ?dat ?d ?p ?numLnkInsStart ?numLnkInsEnd ?numInsDom ?numInsRan ?numTriples\n");
|
---|
186 |
|
---|
187 | // if (targetGraphURIs != null) {
|
---|
188 | // for (String graphURI : targetGraphURIs) {
|
---|
189 | // queryStr.append("FROM <");
|
---|
190 | // queryStr.append(graphURI);
|
---|
191 | // queryStr.append(">\n");
|
---|
192 | // }
|
---|
193 | // }
|
---|
194 |
|
---|
195 | queryStr.append("WHERE{\n");
|
---|
196 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_RDF_TYPE).append("> <").append(URICollection.RESOURCE_SB_CLASS_RELATION).append(">. \n");
|
---|
197 | queryStr.append(" ?propPart <").append(URICollection.PROPERTY_SB_CLASS_RELATION).append("> ?cr. \n");
|
---|
198 | queryStr.append(" ?propPart <").append(URICollection.PROPERTY_VOID_PROPERTY).append("> ?p. \n");
|
---|
199 |
|
---|
200 | queryStr.append(" {");
|
---|
201 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_SUBJECT_CLASS).append("> <" + originClass + ">. \n");
|
---|
202 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_OBJECT_CLASS).append("> ?d. \n");
|
---|
203 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_SUBJECTS).append("> ?numLnkInsStart. \n");
|
---|
204 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_OBJECTS).append("> ?numLnkInsEnd. \n");
|
---|
205 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_TRIPLES).append("> ?numTriples. \n");
|
---|
206 | // queryStr.append(" ?cr <http://sparqlbuilder.org/startClassLimitedQ> ?isStartClsLim. \n");
|
---|
207 | // queryStr.append(" ?cr <http://sparqlbuilder.org/endClassLimitedQ> ?isEndClsLim. \n");
|
---|
208 | queryStr.append("}\n");
|
---|
209 | queryStr.append(" UNION\n");
|
---|
210 | queryStr.append(" {");
|
---|
211 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_SUBJECT_CLASS).append("> <" + originClass + ">. \n");
|
---|
212 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_OBJECT_DATATYPE).append("> ?dat. \n");
|
---|
213 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_SUBJECTS).append("> ?numLnkInsStart. \n");
|
---|
214 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_OBJECTS).append("> ?numLnkInsEnd. \n");
|
---|
215 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_TRIPLES).append("> ?numTriples. \n");
|
---|
216 | // queryStr.append(" ?cr <http://sparqlbuilder.org/startClassLimitedQ> ?isStartClsLim. \n");
|
---|
217 | // queryStr.append(" ?cr <http://sparqlbuilder.org/endClassLimitedQ> ?isEndClsLim. \n");
|
---|
218 | queryStr.append("}\n");
|
---|
219 | queryStr.append(" UNION\n");
|
---|
220 | queryStr.append(" {");
|
---|
221 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_OBJECT_CLASS).append("> <" + originClass + ">. \n");
|
---|
222 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_SB_SUBJECT_CLASS).append("> ?c. \n");
|
---|
223 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_SUBJECTS).append("> ?numLnkInsEnd. \n");
|
---|
224 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_DISTINCT_OBJECTS).append("> ?numLnkInsStart. \n");
|
---|
225 | queryStr.append(" ?cr <").append(URICollection.PROPERTY_VOID_TRIPLES).append("> ?numTriples. \n");
|
---|
226 | // queryStr.append(" ?cr <http://sparqlbuilder.org/startClassLimitedQ> ?isEndClsLim. \n");
|
---|
227 | // queryStr.append(" ?cr <http://sparqlbuilder.org/endClassLimitedQ> ?isStartClsLim. \n");
|
---|
228 | queryStr.append("}\n");
|
---|
229 |
|
---|
230 | // queryStr.append(" ?propPart <").append(URICollection.PROPERTY_RDF_TYPE).append("> <").append(URICollection.PROPERTY_VOID_PROPERTY_PARTITION).append(">. \n");
|
---|
231 | queryStr.append(" ?propPart <").append(URICollection.PROPERTY_SB_PROPERTY_CATEGORY).append("> ?indPropCat. \n");
|
---|
232 |
|
---|
233 | queryStr.append(" ?propPart <").append(URICollection.PROPERTY_VOID_DISTINCT_SUBJECTS).append("> ?numInsDom. \n");
|
---|
234 | queryStr.append(" ?propPart <").append(URICollection.PROPERTY_VOID_DISTINCT_OBJECTS).append("> ?numInsRan. \n");
|
---|
235 |
|
---|
236 | queryStr.append("}\n");
|
---|
237 |
|
---|
238 |
|
---|
239 | if (limit > 0) {
|
---|
240 | queryStr.append("limit ");
|
---|
241 | queryStr.append(limit);
|
---|
242 | queryStr.append("\n");
|
---|
243 | }
|
---|
244 |
|
---|
245 | // System.out.println("getNextClasses SPARQL Query: ");
|
---|
246 | // System.out.println(queryStr.toString());
|
---|
247 |
|
---|
248 | Query query = QueryFactory.create(queryStr.toString());
|
---|
249 | QueryExecution qexec = null;
|
---|
250 | ResultSet results = null;
|
---|
251 | try {
|
---|
252 | long start = System.currentTimeMillis();
|
---|
253 | qexec = QueryExecutionFactory.create(query, model);
|
---|
254 | results = qexec.execSelect();
|
---|
255 | long end = System.currentTimeMillis();
|
---|
256 | System.out.println("EXEC TIME: " + (end - start));
|
---|
257 | } catch (Exception ex) {
|
---|
258 | ex.printStackTrace();
|
---|
259 | throw ex;
|
---|
260 | }
|
---|
261 |
|
---|
262 | ArrayList<ClassLink> solCLs = new ArrayList<ClassLink>();
|
---|
263 | for (; results.hasNext();) {
|
---|
264 | QuerySolution sol = results.next();
|
---|
265 | Resource pro = sol.getResource("p");
|
---|
266 | String clsURI = null;
|
---|
267 | String datURI = null;
|
---|
268 | if (pro != null) {
|
---|
269 | int indPropCat = 4;
|
---|
270 | Literal indPropCatLit = sol.getLiteral("indPropCat");
|
---|
271 | if( indPropCatLit != null ){
|
---|
272 | indPropCat = indPropCatLit.getInt();
|
---|
273 | }
|
---|
274 | if( indPropCat < 4 ) {
|
---|
275 | String proURI = pro.getURI();
|
---|
276 | Resource ccls = sol.getResource("c");
|
---|
277 | Resource dcls = sol.getResource("d");
|
---|
278 | Resource dat = sol.getResource("dat");
|
---|
279 | Direction direction = null;
|
---|
280 | if(ccls != null && dcls == null ){
|
---|
281 | // direction forward
|
---|
282 | direction = Direction.reverse;
|
---|
283 | clsURI = ccls.getURI();
|
---|
284 | }else{
|
---|
285 | if( ccls == null && dcls != null ){
|
---|
286 | direction = Direction.forward;
|
---|
287 | clsURI = dcls.getURI();
|
---|
288 | }else{
|
---|
289 | if( ccls == null && dat != null && dcls == null ){
|
---|
290 | clsURI = null;
|
---|
291 | direction = Direction.forward;
|
---|
292 | datURI = dat.getURI();
|
---|
293 | }
|
---|
294 | }
|
---|
295 | }
|
---|
296 |
|
---|
297 |
|
---|
298 | int numTriples = 0;
|
---|
299 | Literal numTriplesLit = sol.getLiteral("numTriples");
|
---|
300 | if( numTriplesLit != null ){
|
---|
301 | numTriples = numTriplesLit.getInt();
|
---|
302 | }
|
---|
303 |
|
---|
304 | int numLnkInsStart = 0;
|
---|
305 | Literal numInsStartLit = sol.getLiteral("numLnkInsStart");
|
---|
306 | if( numInsStartLit != null ){
|
---|
307 | numLnkInsStart = numInsStartLit.getInt();
|
---|
308 | }
|
---|
309 | int numLnkInsEnd = 0;
|
---|
310 | Literal numInsEndLit = sol.getLiteral("numLnkInsEnd");
|
---|
311 | if( numInsEndLit != null ){
|
---|
312 | numLnkInsEnd = numInsEndLit.getInt();
|
---|
313 | }
|
---|
314 |
|
---|
315 | int numInsDom = 0;
|
---|
316 | Literal numInsDomLit = sol.getLiteral("numInsDom");
|
---|
317 | if( numInsDomLit != null ){
|
---|
318 | numInsDom = numInsDomLit.getInt();
|
---|
319 | }
|
---|
320 | int numInsRan = 0;
|
---|
321 | Literal numInsRanLit = sol.getLiteral("numInsRan");
|
---|
322 | if( numInsRanLit != null ){
|
---|
323 | numInsRan = numInsRanLit.getInt();
|
---|
324 | }
|
---|
325 |
|
---|
326 | boolean isStartClsLim = false;
|
---|
327 | Literal isStartClsLimLit = sol.getLiteral("isStartClsLim");
|
---|
328 | if( isStartClsLimLit != null ){
|
---|
329 | isStartClsLim = isStartClsLimLit.getBoolean();
|
---|
330 | }
|
---|
331 | boolean isEndClsLim = false;
|
---|
332 | Literal isEndClsLimLit = sol.getLiteral("isEndClsLim");
|
---|
333 | if( isEndClsLimLit != null ){
|
---|
334 | isEndClsLim = isEndClsLimLit.getBoolean();
|
---|
335 | }
|
---|
336 |
|
---|
337 | ClassLink cl = new ClassLink(proURI, clsURI, datURI, direction,
|
---|
338 | numTriples, numInsDom, numInsRan, numLnkInsStart, numLnkInsEnd, isStartClsLim, isEndClsLim);
|
---|
339 | solCLs.add(cl);
|
---|
340 |
|
---|
341 | }
|
---|
342 | }
|
---|
343 | }
|
---|
344 | qexec.close();
|
---|
345 | return solCLs.toArray(new ClassLink[0]);
|
---|
346 | }
|
---|
347 |
|
---|
348 |
|
---|
349 |
|
---|
350 | /*
|
---|
351 |
|
---|
352 | public ClassLink[] getNextClassViaInstanceLink(String[] graphURIs, String originClass, int limit) throws Exception;
|
---|
353 |
|
---|
354 | public Path[] getPaths(String startClass, String endClass, int mode, boolean countLinks) throws Exception;
|
---|
355 |
|
---|
356 | public String createSPARQL(Path path) throws Exception;
|
---|
357 |
|
---|
358 | InstanceLink[] getNextInstancesViaInstanceLink(String[] graphURIs, String originInstance,
|
---|
359 | int limit) throws Exception;
|
---|
360 | */
|
---|
361 |
|
---|
362 | public LabelMap[] getLabels(String[] graphURIs, String[] resourceURIs,
|
---|
363 | String language) throws Exception {
|
---|
364 | if (resourceURIs == null || resourceURIs.length == 0) {
|
---|
365 | return new LabelMap[0];
|
---|
366 | }
|
---|
367 | StringBuffer queryStr = new StringBuffer();
|
---|
368 | queryStr.append("PREFIX owl: <http://www.w3.org/2002/07/owl#>\n");
|
---|
369 | queryStr.append("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n");
|
---|
370 | queryStr.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n");
|
---|
371 | queryStr.append("SELECT DISTINCT ?res ?label \n");
|
---|
372 | if (graphURIs != null) {
|
---|
373 | for (String graphURI : graphURIs) {
|
---|
374 | queryStr.append("FROM <");
|
---|
375 | queryStr.append(graphURI);
|
---|
376 | queryStr.append(">\n");
|
---|
377 | }
|
---|
378 | }
|
---|
379 | queryStr.append("WHERE{\n");
|
---|
380 | queryStr.append(" ?res rdfs:label ?label.\n");
|
---|
381 | queryStr.append(" FILTER(?res IN (");
|
---|
382 | boolean f = false;
|
---|
383 | for (String resourceURI : resourceURIs) {
|
---|
384 | if (f) {
|
---|
385 | queryStr.append(", ");
|
---|
386 | }
|
---|
387 | f = true;
|
---|
388 | queryStr.append("<");
|
---|
389 | queryStr.append(resourceURI);
|
---|
390 | queryStr.append(">");
|
---|
391 | }
|
---|
392 | queryStr.append("))\n");
|
---|
393 | queryStr.append("}");
|
---|
394 |
|
---|
395 | // System.out.println(queryStr.toString());
|
---|
396 |
|
---|
397 | Query query = QueryFactory.create(queryStr.toString());
|
---|
398 | QueryExecution qexec = QueryExecutionFactory.create(query, model);
|
---|
399 |
|
---|
400 | ResultSet results = qexec.execSelect();
|
---|
401 | HashMap<String, LabelMap> lMap = new HashMap<String, LabelMap>();
|
---|
402 | for (; results.hasNext();) {
|
---|
403 | QuerySolution sol = results.next();
|
---|
404 | String uri = sol.getResource("res").getURI();
|
---|
405 | Literal literal = sol.getLiteral("label");
|
---|
406 | if (literal != null) {
|
---|
407 | String label = literal.getString();
|
---|
408 | String lang = literal.getLanguage();
|
---|
409 | if (language != null && language.equals(lang)) {
|
---|
410 | Label lbl = new Label(label, lang);
|
---|
411 | if (lMap.containsKey(uri)) {
|
---|
412 | LabelMap lm = lMap.get(uri);
|
---|
413 | lm.addLabel(lbl);
|
---|
414 | } else {
|
---|
415 | LabelMap lm = new LabelMap(uri, new Label[] { lbl });
|
---|
416 | lMap.put(uri, lm);
|
---|
417 | }
|
---|
418 | }
|
---|
419 | }
|
---|
420 | }
|
---|
421 | return lMap.values().toArray(new LabelMap[0]);
|
---|
422 | }
|
---|
423 |
|
---|
424 | /*
|
---|
425 | public ClassLink[] countLinks(String[] graphURIs, String startClassURI, ClassLink[] classLinks) throws Exception;
|
---|
426 | public SClass[] countInstances(String[] graphURIs, SClass[] classes) throws Exception;
|
---|
427 |
|
---|
428 | */
|
---|
429 |
|
---|
430 | }
|
---|