losd(当前)是一个非常简单的python包,用于查询losd(链接的开放社会数据)数据集

losd的Python项目详细描述


损失

一个非常简单的Python包,用于SPARQL查询LoSd(链接开放的社会数据)数据集。

使用

安装
$ pip install losd

$ python setup.py losd

为了更好地控制定制、黑客攻击和调试,请克隆存储库并使用-e:

使用pip安装
$ git clone https://github.com/ttm/losd.git
$ pip3 install -e <path_to_repo>

用法

查询标题为:

PREFIX po: <http://purl.org/socialparticipation/po/>

用法示例:

importlosdaslpl=l.plainQueryValuesq=l.query# get all snapshots:query='''SELECT ?s WHERE {  ?s a po:Snapshot}'''res=pl(q(query))########### from here on, check to assure that the uris correspond to# the snapshot (types) intended# get all friendship relations in a facebook snapshot:uri=res[99]query='''SELECT ?a1 ?a2 WHERE {?f a po:Friendship . ?f po:snapshot <%s> .?f po:member ?a1, ?a2 .FILTER(?a1 != ?a2)}'''%(uri,)res2=pl(q(query))# get all retweet interactions in a Twitter snapshot:uri=res[-1]query='''SELECT ?a1 ?a2 WHERE {?m1 po:retweetOf ?m2 . ?m1 po:author ?a1 . ?m2 po:author ?a2 .?m1 po:snapshot <%s>}'''%(uri,)res3=pl(q(query))# get all interactions in a email snapshot:uri=res[48]query='''SELECT ?from ?to WHERE {?message1 po:snapshot <%s> . ?message2 po:replyTo ?message1 .?message1 po:author ?from . ?message2 po:author ?to .}'''%(uri,)res4=pl(q(query))# get all interactions in a IRC snapshot, with texts:uri=res[102]query='''SELECT ?a1 ?a2 ?t WHERE {?m a po:IRCMessage . ?m po:author ?a1 . ?m po:directedTo ?a2 .?m po:cleanText ?t . ?m po:snapshot <%s>}'''%(uri,)res5=pl(q(query))# get all interactions in the AA snapshot:query='''SELECT ?a1 ?a2 WHERE {?s po:author ?a1 . ?s po:checkParticipant ?a2 .}'''res6=pl(q(query))# get all friendshipts in the Participa.BR snapshot:uri=res[104]query='''SELECT ?a1 ?a2 WHERE {?f a po:Friendship . ?f po:snapshot <%s> .?f po:member ?a1, ?a2 .FILTER(?a1 != ?a2)}'''%(uri,)res7=pl(q(query))# get all interactions in the Participa.BR snapshot:uri=res[104]query='''SELECT ?a1 ?a2 WHERE {?a po:snapshot <%s> . ?a a po:Article .?a po:author ?a1 . ?c po:article ?a . ?c po:author ?a2 .}'''%(uri,)res8=pl(q(query))# get all interaction in the Cidade Democrática snapshot:uri=res[45]query='''SELECT ?a1 ?a2 WHERE {?t po:snapshot <%s> .  ?t a po:Topic . ?t po:author ?a1 .?c a po:Comment . ?c po:topic ?t . ?c po:author ?a2 .}'''%(uri,)res9=pl(q(query))interaction=[res3,res4,res5,res6,res8,res9]friendship=[res2,res7,]fr=[]forrelationsinfriendship:fr.append(l.mkRelationNetwork(relations))inte=[]forinteractionsininteraction:inte.append(l.mkInteractionNetwork(interactions))# finished. Play with the networks in fr and inte# maybe use networkx and pylab to plat them# :::

部署到pypi

此程序包通过运行: $python3 setup.py sdist设置 $tween上传距离/

可能使用“python setup.py sdist upload-r pypi”?

更多信息

更多信息请参见losd文章库:

更好的使用

请考虑注册到data.world,以便按照他们的政策使用losd,并为他们的工作人员提供帮助。 看看their own python package

接触

任何问题、问题或想法都应发送至:

雷纳托(点)法布里[at]gmail{dot}com

:::

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在安卓中以编程方式扫描无线网络和连接?   Java中的mysql JSP登录问题   java改造2.0多拦截器   运行方法内部的java线程状态冲突;为什么线程状态不是“正在运行”   java Ruby Compass编译器输出   java简单密钥侦听器   java无法统计应用程序。从2.0.6更新SpringBoot之后。发布到2.1.0。释放   使用Hibernate应用程序的java Spring启动失败   java CommonExec:在系统路径上执行程序?   JavaSwing实现基于阶段的GUI的正确方法是什么?   java如何使用GWT编程设置CSS类的宽度?   scala java。lang.NoSuchFieldException:_ebean_道具总是在将ebean从3.3.4升级到4.5.5时出现,   java Android:开发的应用程序可以在emulator中运行,但不能安装在我的设备中   java“null”是如何工作的?它的值是常数吗?   使用JBeret运行SleepyBatchlet时发生java JSR352 JBeret错误