You can use type predicate to give node a type.
e.g:-
_:dept1 <name> "dept1" .
_:dept1 <some_other_predicate> "blabla" .
_:dept1 <type> "department"
and in query use eq function as eq(type,"department")
This returns all departments.
Another way is to give node specific predicate name.
e.g. -
Instead of using <name> predicate use < dept_name> and then in query use has(dept_name)
This will also returns all departments.
For more information read here - Get started with Dgraph
Read the query docs here - Get started with Dgraph
You will find all the answers there.