How to implement this algorithm in java?
SPARQL query extracts the patterns
with length one and their frequencies from the linked data:
SELECT DISTINCT ?c1 ?p ?c2 (COUNT(*) as ?count)
WHERE { ?x ?p ?y. ?x rdf:type ?c1. ?y rdf:type ?c2. }
GROUP BY ?c1 ?p ?c2
Input: LD (the linked data repository), k (maximum length of patterns)
Output: A set of LD patterns
1: P1 <- extract patterns of length one from LD
2: P <- P1, i <-1
3: while i < k do
4: for each pattern pi -> Pi do
5: for each ontology class c in pi do
6: P1,c all the patterns in P1 that include c
7: for each pattern p1,c 2 P1,c do
8: pjoin construct a pattern by joining pi and p1,c on node c
9: if pjoin exists in LD then
10: Pi+1 Pi+1 [ pjoin
11: end if
12: end for
13: end for
14: end for
15: P P [ Pi+1, i i + 1
16: end while
return P