All Projects → yubinCloud → pyfuseki

yubinCloud / pyfuseki

Licence: Apache-2.0 license
A library that uses Python to connect and manipulate Jena Fuseki, which provides sync and async methods.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyfuseki

OLGA
an Ontology SDK
Stars: ✭ 36 (+63.64%)
Mutual labels:  sparql, rdf, owl
cognipy
In-memory Graph Database and Knowledge Graph with Natural Language Interface, compatible with Pandas
Stars: ✭ 31 (+40.91%)
Mutual labels:  sparql, rdf, owl
semantic-python-overview
(subjective) overview of projects which are related both to python and semantic technologies (RDF, OWL, Reasoning, ...)
Stars: ✭ 406 (+1745.45%)
Mutual labels:  sparql, rdf, owl
ont-api
ONT-API (OWL-API over Apache Jena)
Stars: ✭ 20 (-9.09%)
Mutual labels:  sparql, rdf, owl
mobi
Mobi is a decentralized, federated, and distributed graph data platform for teams and communities to publish and discover data, data models, and analytics that are instantly consumable.
Stars: ✭ 41 (+86.36%)
Mutual labels:  sparql, rdf, owl
LinkedDataHub
The Knowledge Graph notebook. Apache license.
Stars: ✭ 150 (+581.82%)
Mutual labels:  sparql, rdf, owl
Ontodia
Ontodia data diagraming library
Stars: ✭ 107 (+386.36%)
Mutual labels:  sparql, rdf
Graphql To Sparql.js
Converts GraphQL queries to SPARQL queries
Stars: ✭ 62 (+181.82%)
Mutual labels:  sparql, rdf
Rdf Ext
RDF library for NodeJS and the Browsers
Stars: ✭ 97 (+340.91%)
Mutual labels:  sparql, rdf
Virtuoso Sparql Endpoint Quickstart
creates a docker image with Virtuoso preloaded with the latest DBpedia dataset
Stars: ✭ 80 (+263.64%)
Mutual labels:  sparql, rdf
Trifid
Lightweight Linked Data Server and Proxy
Stars: ✭ 51 (+131.82%)
Mutual labels:  sparql, rdf
Semantic forms
Form generators leveraging semantic web standards (RDF(S), OWL, SPARQL , ...
Stars: ✭ 63 (+186.36%)
Mutual labels:  sparql, rdf
Server.js
A Triple Pattern Fragments server for Node.js
Stars: ✭ 149 (+577.27%)
Mutual labels:  sparql, rdf
Hypergraphql
GraphQL interface for querying and serving linked data on the Web.
Stars: ✭ 112 (+409.09%)
Mutual labels:  sparql, rdf
Comunica
📬 A knowledge graph querying framework for JavaScript
Stars: ✭ 183 (+731.82%)
Mutual labels:  sparql, rdf
Nspm
🤖 Neural SPARQL Machines for Knowledge Graph Question Answering.
Stars: ✭ 156 (+609.09%)
Mutual labels:  sparql, rdf
Rasqal
Redland Rasqal RDF Query Library
Stars: ✭ 57 (+159.09%)
Mutual labels:  sparql, rdf
Client.js
[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.
Stars: ✭ 95 (+331.82%)
Mutual labels:  sparql, rdf
Akutan
A distributed knowledge graph store
Stars: ✭ 1,616 (+7245.45%)
Mutual labels:  sparql, rdf
Dotnetrdf
dotNetRDF is a powerful and flexible API for working with RDF and SPARQL in .Net environments
Stars: ✭ 199 (+804.55%)
Mutual labels:  sparql, rdf

PyFuseki

pyfuseki - An easy way to mix together OWL and Jena Fuseki.

一个用来连接并操作 Apache Jena Fuseki 的 Python 库,同时提供了同步和异步的两种操作方式。通过使用它,你可以很简单地将你的数据插入 Fuseki 中。


Documentation: https://yubincloud.github.io/pyfuseki/

Source Code: https://github.com/yubinCloud/pyfuseki


Requirements

Python 3.6+

PyFuseki 基于以下三个库来实现任务:

Installation

$ pip install pyfuseki

Example

这里有个简单的例子来演示如何将你的数据插入到 Fuseki 中,先不用究于细节,之后我们会对每一部分进行讲解。

  • 首先,我们先按照本体来定义出里面的类,以方便实例化数据:
from pyfuseki.rdf import rdf_prefix, NameSpace as ns

@rdf_prefix('http://expample.com/')
class RdfPrefix():
    Person: ns
    Dog: ns

rp = RdfPrefix()
  • 接下来,我们按照本体中来定义出里面的关系(属性),以方便表示该关系:
from pyfuseki.rdf import rdf_property
from rdflib import URIRef as uri

@rdf_property('http://example.org/')
class ObjectProperty:
    own: uri 

@rdf_property('http://example.org/')
class DataProperty:
    hasName: uri
  • 最后,我们实例化出一些数据,并将其相关陈述(三元组)插入到图中:
from pyfuseki import FusekiUpdate
from rdflib import Graph, Literal, RDF

g = Graph()

# 实例化数据
person = rp.Person['12345']  # 假设 '12345' 是这个人的唯一身份证号
dog = rp.Dog['56789']  # 假设这只狗也有唯一的 ID 为 ‘56789’

# 将陈述加入到图中
g.add((person, RDF.type, rp.Person.to_uri()))  # 声明 person 的类型是 Person
g.add((dog, RDF.type, rp.Dog.to_uri()))
g.add((person, dp.hasName, Literal('Ryan')))  # 加入了一条三元组,表示 person1 有名字为 'Ryan'
g.add((dog, dp.hasName, Literal('lucy')))
g.add((person, op.own, dog))

# 把图插入到 Fuseki 中
fuseki = FusekiUpdate('http://localhost:3030', 'test_db')
fuseki.insert_graph(g)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].