简体   繁体   English

如何在C#模型类中解析RDF本体(龟文件)

[英]How to parse the RDF ontology (turtle file) in c# model classes

I have the ontology file. 我有本体文件。 I want to write the OData services on top of my graph database. 我想在我的图形数据库上编写OData服务。 For this I need to provide the EdmModel in order to register my OData route. 为此,我需要提供EdmModel来注册我的OData路由。 but it can not be done because schema is in ttl file and also in the server. 但是无法完成,因为架构既在ttl文件中,也在服务器中。 According to this blog , we can create the model by fetching the schema from the server. 根据此博客 ,我们可以通过从服务器获取模式来创建模型。 But there github code is having lot of issues. 但是那里的github代码有很多问题。 Is there anyone know how to convert it to the c# model classes? 有谁知道如何将其转换为c#模型类?

My sample schema in turtle format : 我的示例模式为乌龟格式:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix : <http://www.example.com/schema/abc#> .

: a owl:Ontology .

# Class
:Organization a owl:Class ;
  rdfs:label "Organization"@en ;
  skos:definition ""@en .

# Properties
:Name a owl:DatatypeProperty ;
  rdfs:domain :Organization ;
  rdfs:range xsd:string .
:CreatedDate a owl:DatatypeProperty ;
  rdfs:domain :Organization ;
  rdfs:range xsd:dateTime .

# Relation
:hasRole a owl:ObjectProperty ;
  rdfs:domain :Organization ;
  rdfs:range :Role .  

There are some translators from SPARQL to OData. 有一些从SPARQL到OData的转换器。 I haven't tried them, but here are some links. 我没有尝试过,但是这里有一些链接。 If you search for "odata rdf" or "odata sparql", you'll find more links on Stack Exchange. 如果搜索“ odata rdf”或“ odata sparql”,则会在Stack Exchange上找到更多链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM