SELECT DISTINCT ?topLevel ?subClass ?directParent (count(?mid) as ?depth)FROM <tag:stardog:api:context:all>WHERE{#get the top level classes?topLevel rdf:type owl:Class .
#get ?subClasses of ?topLevel classes?mid rdfs:subClassOf* ?topLevel .?subClass rdfs:subClassOf+ ?mid .
#get the ?directParent of each subClass
?subClass rdfs:subClassOf ?directParent .
}GROUP BY ?topLevel ?subClass ?directParentORDER BY ?topLevel ?depth
Please help me, I really need to split the data among separate named graphs.Thanks you.
--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
>stardog data add --named-graph http://www.example.org/schema1 -- MYDB Desktop\Tree1.owlHere is the query:
>stardog data add --named-graph http://www.example.org/schema2 -- MYDB Desktop\Tree2.owl
SELECT DISTINCT ?superLabel ?subLabel (count(?mid) as ?d)
FROM<tag:stardog:api:context:all>WHERE{
Here is the Result:?mid rdfs:subClassOf* ?super .?sub rdfs:subClassOf+ ?mid .?super rdfs:label ?superLabel .?sub rdfs:label ?subLabel .}GROUP BY ?superLabel ?subLabelORDER BY ?superLabel ?d
Wrong results are highlighted above. Note that G and H are in schema2 context and others are in schema1.+------------+----------+-------+| superLabel | subLabel | d |+------------+----------+-------+| "A" | "B" | 1 || "A" | "C" | 1 || "A" | "D" | 1 || "A" | "E" | 2 || "A" | "F" | 2 || "A" | "G" | 3 || "A" | "H" | 4 || "B" | "F" | 1 || "B" | "E" | 1 || "B" | "G" | 2 || "B" | "H" | 3 || "E" | "G" | 2 || "E" | "H" | 3 || "G" | "H" | 1 |+------------+----------+-------+
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.