Git Product home page Git Product logo

rdfmappernet's Introduction

RdfMapperNet

RdfMapperNet is a .NET library to map classes to RDF triples. Attributes are used to annotate classes and their properties in order to map them to subjects, predicates and objects.

Dependencies:

Example

The mapping document in JSON format

{
  "namespaces": {
    "ns1": "http://www.smir.ch/api/",
    "ns2": "http://www.virtualskeleton.ch/schema/rdf-mapping#",
    "ns3": "http://www.virtualskeleton.ch/schema/metadata4data#"
  },
  "map": {
    "ns2:s_file_uri": "ns1:files/{id}",
    "ns2:o_file_rdf_type": "ns3:file",
    "ns2:p_file_id": "ns3:file_id",
	"ns2:p_file_extension": "ns3:file_extension"
  }
}

The class to be mapped

[RdfMapperSubject("s_file_uri", RdfType = "o_file_rdf_type")]
public class File
{
	[RdfMapperSubjectId]
	[RdfMapperPredicate("p_file_id")]
	public int Id { get; set; }

	[RdfMapperPredicate("p_file_extension")]
	public string Extension { get; set; }
}

Map the class to RDF triples

var mapper = new RdfMapper(new RdfMapperJsonReader(), mappingDocumentPath, mappingNamespace);
var triples = mapper.MapTriples(model);

Output

'http://www.smir.ch/api/files/1'	'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'						'http://www.virtualskeleton.ch/schema/metadata4data#file'
'http://www.smir.ch/api/files/1'	'http://www.virtualskeleton.ch/schema/metadata4data#file_id'			'1'
'http://www.smir.ch/api/files/1'	'http://www.virtualskeleton.ch/schema/metadata4data#file_extension'		'dcm'

rdfmappernet's People

Contributors

niklr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.