Improve RDF.Description.pop/1
This commit is contained in:
parent
909e2bde18
commit
3f6393a191
1 changed files with 3 additions and 4 deletions
|
@ -529,13 +529,12 @@ defmodule RDF.Description do
|
|||
def pop(description)
|
||||
|
||||
def pop(description = %__MODULE__{predications: predications})
|
||||
when predications == %{},
|
||||
when map_size(predications) == 0,
|
||||
do: {nil, description}
|
||||
|
||||
def pop(%__MODULE__{subject: subject, predications: predications}) do
|
||||
# TODO: Find a faster way ...
|
||||
predicate = List.first(Map.keys(predications))
|
||||
[{object, _}] = Enum.take(objects = predications[predicate], 1)
|
||||
[{predicate, objects}] = Enum.take(predications, 1)
|
||||
[{object, _}] = Enum.take(objects, 1)
|
||||
|
||||
popped =
|
||||
if Enum.count(objects) == 1,
|
||||
|
|
Loading…
Reference in a new issue