Research Article

RDF Subgraph Query Based on Common Subgraph in Distributed Environment

Algorithm 1

CRTQ (, M(v))
Input: Composite relation tree , adjacency table M(v)
Output: Query result set Ω() = {Ω(), Ω(), …, Ω()}
FOR EACH
   Ω1 = CALLSubgraphMatching ();
   IFdj.Leaf(v)Ω1THENΩ() = Ω1;
   j++;
   Ω(T) = Ω()Ω(); //Get the matching result set of
END FOR
RETURNΩ(T);
FUNCTIONSubgraphMatching ()
   IF=d.rootTHENR ← CALLStarDecomposition ();
   WHILER ≠ DO
   t ←1, R.dequeue;
   CALLmap(, M(v));
   IFt >1 THEN
   CALLmap(, β); //βΩ()
   Ω() = CALLreduce(, Ω(), Ω()));
   END IF(
   t++;
   END WHILE
   ELSE
   R ← CALLStarDecomposition ();
   WHILER ≠ DO
   t ←1, R.dequeue;
   CALLmap(, Ω(.Parent)); //query in the result set of the parent graph
   IFt >1 THEN
   CALLmap(, β); //βΩ()
   Ω() = CALLreduce(, (Ω(), Ω()));
   END IF
   t++;
   END WHILE
   END IF
RETURNΩ();
FUNCTIONmap(, M(v) or β)
   IF input M(v) THEN
      Ω() ← CALLStarMatching (, M(v));
      IFt =1 THEN
         β ← Ω();
         RETURN (, β);
      ELSE
         FOR EACHβΩ()
            ; //get the matching result of as the key value
            RETURN (, β);
         END FOR
      END IF
   ELSE
      ;
      RETURN (, β); //the input value is Ω(), the output is (, β)
   END IF
FUNCTIONreduce(, (Ω(), Ω()))
    FOR EACH
      RETURN; //get the current matching result set Ω()
    END FOR