Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 2.92 KB

README.md

File metadata and controls

91 lines (66 loc) · 2.92 KB

RTC.ex

Hex.pm Hex Docs License

ExUnit Tests Dialyzer Quality Checks

An implementation of RDF Triple Compounds in Elixir.

RDF Triple Compounds (RTC) is a spec which defines a vocabulary around the concept of triple compounds, nestable sub-graphs embedded in RDF-star graphs.

For a guide and more information on its underlying projects, go to https://rdf-elixir.dev/rtc-ex/.

Usage

Create a compound:

iex> [
...>   EX.Employee38 
...>   |> EX.firstName("John")
...>   |> EX.familyName("Smith")
...>   |> EX.jobTitle("Assistant Designer"),
...>   EX.Employee39
...>   |> EX.firstName("Jane")
...>   |> EX.familyName("Doe")
...>   |> EX.jobTitle("HR Manager")
...> ]
...> |> RTC.Compound.new(EX.Compound,
...>   prefixes: [ex: EX],    
...>   annotations: %{EX.dataSource() => EX.DataSource}
...> )
#RTC.Compound<id: ~I<http://example.com/Compound>
  @prefix ex: <http://example.com/> .
  @prefix rtc: <https://w3id.org/rtc#> .

  ex:Compound
      ex:dataSource ex:DataSource ;
      rtc:elements 
        << ex:Employee38 ex:familyName "Smith" >>, 
        << ex:Employee38 ex:firstName "John" >>, 
        << ex:Employee38 ex:jobTitle "Assistant Designer" >>, 
        << ex:Employee39 ex:familyName "Doe" >>, 
        << ex:Employee39 ex:firstName "Jane" >>, 
        << ex:Employee39 ex:jobTitle "HR Manager" >> .

  ex:Employee38
      ex:familyName "Smith" ;
      ex:firstName "John" ;
      ex:jobTitle "Assistant Designer" .

  ex:Employee39
      ex:familyName "Doe" ;
      ex:firstName "Jane" ;
      ex:jobTitle "HR Manager" .
>

Add it to a triple store:

compound
|> RTC.Compound.to_rdf()
|> SPARQL.Client.insert_data("http://example.com/sparql")

And fetch the compound back from a triple store:

RTC.Compound.from_sparql("http://example.com/sparql", EX.Compound)

Contributing

See CONTRIBUTING for details.

Consulting

If you need help with your Elixir and Linked Data projects, just contact NinjaConcept via [email protected].

License and Copyright

(c) 2023-present Marcel Otto. MIT Licensed, see LICENSE for details.