core: RDF.Data protocol

This commit is contained in:
Marcel Otto 2017-05-24 23:37:09 +02:00
parent 5a911a9cce
commit deeed3224f

66
lib/rdf/data.ex Normal file
View file

@ -0,0 +1,66 @@
defprotocol RDF.Data do
@moduledoc """
An abstraction over the different data structures for collections of RDF statements.
"""
@doc """
Add statements to a RDF data structure.
"""
def add(data, statements)
@doc """
Adds statements to a RDF data structure and overwrites all existing statements with the same subjects and predicates.
"""
def put(data, statements)
@doc """
Deletes statements from a RDF data structure.
"""
def delete(data, statements)
@doc """
Deletes one statement from a RDF data structure and returns a tuple with deleted statement and the changed data structure.
"""
def pop(data)
@doc """
Checks if the given statement exists within a RDF data structure.
"""
def include?(data, statements)
@doc """
Returns the list of all statements of a RDF data structure.
"""
def statements(data)
@doc """
Returns the set of all resources which are subject of the statements of a RDF data structure.
"""
def subjects(data)
@doc """
Returns the set of all properties used within the statements of RDF data structure.
"""
def predicates(data)
@doc """
Returns the set of all resources used in the objects within the statements of a RDF data structure.
"""
def objects(data)
@doc """
Returns the set of all resources used within the statements of a RDF data structure
"""
def resources(data)
@doc """
Returns the count of all resources which are subject of the statements of a RDF data structure.
"""
def subject_count(data)
@doc """
Returns the count of all statements of a RDF data structure.
"""
def statement_count(data)
end