Menu
  • HOME
  • TAGS

Persisting data in Jena TDB triple store

rdf,jena,ontology,triplestore,tdb

After receiving feedback and tweaking Jena, I found answers to all points as: Is Ryan correct about what he has discussed about dataset? From Joshua's comment and reading API I found that Jena framework has been improved a lot, so Ryan's explanation about datasets is not valid anymore. Does TDB...

How to insert several new elements into another element with XSL, keeping everything else unchanged

xml,xslt,rdf

First a warning: you shouldn't use plain XML processing tools like XSLT to handle RDF-XML unless there's really no alternative. There are many many equivalent XML representations of the same underlying RDF graph, you're far better off using a proper RDF tool that understands the graph structure. That said... I...

Rdf duplicate triples

rdf

In theory RDF graph is a set of triples, which means that each triple can occur just once. Of course you could have a document, say in Turtle, which contains duplicates of a triple or quads but after loading to memory/store those triples should be treated as one. Any document...

Can I mix skos properties with rdfs properties to define a class?

syntax,rdf,semantic-web,rdfs,skos

Can I define :MyClass as a skos:Concept with SKOS properties and RDFS porperties ? One of the beauties of Semantic Web technology is that you can do just about anything that you want to. RDF, the Resource Description Framework is concerned with describing resources. You're not really defining things...

Sparql join issue

join,rdf,sparql

Confusion between literals and URIs in the data. The data has: local:qUak8jXvdkw someOntology:hasChapter qUak8jXvdkwOverview local:qUak8jXvdkwOverview someOntology:label Overview (did the first line quoted above loose the "" on qUak8jXvdkwOverview - the results suggest it has) This part ?id someOntology:hasChapter ?chapterId . causes result: "chapterId":{"type":"literal","value":"qUak8jXvdkwOverview"}, so ?chapterId here is literal "qUak8jXvdkwOverview". But...

virtuoso-opensource: using jenaprovider, how to read data from file instead of from URL?

java,rdf,virtuoso

Rather than providing just the filename, use a file URI instead. E.g.: graph.read("file:///tmp/index.rdf", "RDF/XML"); ...

Why am I getting “GC overhead limit exceeded” when I use “arq” to query local rdf files

rdf,sparql,freebase

cause you're out of memory as the exception tells you: java.lang.OutOfMemoryError: GC overhead limit exceeded It is well possible that you're actually not out of memory, but that it's just your JVM settings that won't exceed a certain amount of memory by default. As described in http://stackoverflow.com/a/21197787/1423333 try running JVM_ARGS="-Xmx4096M"...

How to build correct SPARQL Query

rdf,sparql,semantic-web,dbpedia,linked-data

I'd use a query like this: select distinct ?player ?birthPlace ?birthDate where { ?player dbpedia-owl:team <http://dbpedia.org/resource/Manchester_United_F.C.> ; a dbpedia-owl:Person ; dbpedia-owl:wikiPageID [] . optional { ?player dbpedia-owl:birthPlace ?birthPlace } optional { ?player dbpedia-owl:birthDate ?birthDate } } SPARQL results Using optional ensures that players without listed birthplaces or birthdates can still...

Maven artifact issue with stardog and sesame dependencies

maven,rdf,jena,sesame,stardog

I don't really know how to help you with the maven dependency problem - this looks very specific to Stardog. If you don't get an answer here you might try asking about this on their support mailinglist instead. However, I can offer an alternative solution: instead of using a convertor...

RDF SPARQL query multiple types

java,rdf,sparql

{ ?object rdf:type ns0:TrainArrival ; rdf:type ns0:PrimaryInformation ; } will match having both TrainArrival and PrimaryInformation...

Cardinality restrictions on SPARQL

rdf,sparql,restrictions,rdfs,cardinality

Now, I want to query all parents, for example, with at least two children (cardinality on hasChild relation) with SPARQL. You just select a parent and child in each row, then group by the parent, and then only take those that have at least two values for child: select...

Consequence of restrictions in ontology on SPARQL end results

rdf,sparql,semantics,owl,ontology

That's because you are querying the TBOX and ?p in your query translates to the bnode representing the anonymous class restriction. You are not binding to instances in the query, but the value/class used for the owl:allValuesFrom restriction. So http://purl.oclc.org/NET/ssnx/qu/dim#Temperature would be the result of your query. Had you wanted...

How to define an rdfs:range target in a list of possibilities?

syntax,rdf,owl,protege,rdfs

The reason this is not working is because owl:oneOf is defined as: An enumeration is a owl:oneOf element, containing a list of the objects that are its instances. This enables us to define a class by exhaustively enumerating its elements. The class defined by the oneOf element contains exactly the...

RDF Data Cube uses property as object?

rdf,ontology,data-cube

The key is in the document that you linked to: 6. Creating data structure definitions A qb:DataStructureDefinition defines the structure of one or more datasets. In particular, it defines the dimensions, attributes and measures used in the dataset along with qualifying information such as ordering of dimensions and whether attributes...

What is the use of @vocab in JSON-LD and what is the difference to @context?

rdf,json-ld

@vocab is used specifically to declare a default vocabulary from which all terms derive, without having to declare specific mappings for each term (as you normally do in a @context). For example, see this snippet (taken from the JSON-LD 1.0 spec): { "@context": { "@vocab": "http://schema.org/" } "@id": "http://example.org/places#BrewEats", "@type":...

How to write Jena rule to query class and get individuals for a property

rdf,sparql,jena,semantic-web

The rule [rule1: noValue(:users :hasLocation :home) -> (:actuators :hasLocation :home) (:actuators :state "OFF"^^xsd:boolean)] doesn't do what you expect it to, and there may very well be some typos, too. In your ontology (in the future, please provide code that we can actually copy and paste, e.g.,the TTL serialization, or the...

getting all dbpedia predicate list [duplicate]

rdf,sparql,dbpedia

This is based on a modification of my answer to SPARQL query to get all class label with namespace prefix defined. select distinct ?prettyName ?property where { #-- get distinct properties that are used on Persons { select distinct ?property where { [ a dbpedia-owl:Person ; ?property [] ] }...

OWL. How to express that siblings has common parent?

rdf,semantics,semantic-web,owl

Dave is father of Mary and Mary sister of Jack. I want reason that Dave have two childs Jack and Mary. If you ignore the possibility of siblings having different parents (e.g., a parent in common and a different parent), then you can do this with subproperty chains. If...

SPARQL query to get skos:broader property of a dbpedia category

rdf,sparql,dbpedia

Regarding point a, you can escape characters in a SPARQL 1.1 prefixed name by adding a backslash in front: category:Companies_based_in_Menlo_Park\,_California Unfortunately, however, that does not work on the DBPedia endpoint, because its SPARQL engine is not fully up to date with the SPARQL 1.1 standard. A workaround is to use...

does SWRL supports blank node inference as Jena?

rdf,jena,inference,swrl,inference-engine

The variables in SWRL rules take on values that are OWL individuals and RDF literals. A blank node cannot be an RDF literal, although a blank node could be an unnamed OWL individual. (I'm not sure whether SWRL will work with unnamed but declared individuals; it won't work with individuals...

SPARQL why are there both DELETE and WHERE conditions?

rdf,sparql,triplestore,sparul

Because what you delete may not be what you match with WHERE. There is a special form for the first case: DELETE WHERE { ?s a :answers } In the second, ?p and ?o are not bound. Try: DELETE { ?s ?p ?o } WHERE { ?s a :answers ....

Does ARQ support SPARQL 1.1 Date and Time Functions?

java,rdf,sparql,jena,arq

Yes, Jena supports all the SPARQL 1.1 functions. You have having problems because "2015-01-07T15:22:53+00:00:00"^^<xsd:dateTime> is not a datetime. "2015-01-07T15:22:53+00:00:00"^^http://www.w3.org/2001/XMLSchema#dateTime> or "2015-01-07T15:22:53+00:00:00"^^xsd:dateTime <xsd:dateTime> is a completely different URI, URI scheme name "xsd"....

How to read all object properties from Ontology in Java using Jena library?

java,rdf,owl,apache-jena

If you want to get the list of object properties having a type declared as domain or range, one way of doing it with Jena is the following: public void objectPropertiesForType(Model m, final Resource type) { StmtIterator i = m.listStatements(new SimpleSelector() { @Override public boolean test(Statement s) { if (s.getPredicate().equals(RDFS.domain)...

librdf raptor deal with integer value in object

c++,rdf

The problem is that your data is not valid NTriples so libraptor is quite correct in rejecting it. Your data fragment is using a syntactic compression called plain literals which is not valid in NTriples. This compression is actually from the Turtle format (which is a super-set of NTriples) so...

XForms repeat: same element name, different value constraints

xml,xpath,rdf,xforms,xsltforms

At present, the default URIs are all coming from the same namespace (http://id.loc.gov/vocabulary/...), so a temporary solution is just to filter for that value: not(starts-with(@rdf:resource, 'http://id.loc.gov/vocabulary/geographicAreas/')). For the longer term, I'm investigating nomisma.org, which embodies a more sustainable approach to linked data vocab management in XForms. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet...

How to do the concept search in SKOS?

rdf,skos

The data you provided isn't complete; it's missing some prefix declarations, and it uses relative IRIs but doesn't define a base IRI. Here's some complete data we can use: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#"> <skos:Concept rdf:about="http://stackoverflow.com/q/27958866/1281433/TemperatureSensor"> <skos:altLabel xml:lang="en">T</skos:altLabel> <skos:altLabel xml:lang="en">Temp</skos:altLabel> <skos:altLabel...

Is there a syntax to define cyclic reference between anonymous nodes in turtle/rdf?

syntax,rdf,turtle

RDF's data model is graph-based, not hierarchical, so there is no notion of parent/child relationships between resources, and hence no built-in syntax to refer to 'parent' nodes when nesting anonymous resource descriptions with the [] construct (which is really just syntactic sugar for grouping together a bunch of triples sharing...

verify an example about how the rdf and rdfs related?

rdf,semantic-web,rdfs

Is this the right way how rdfs and rdf related? This part of the question is a bit unclear. RDF is a data representation based on triples of the form (subject, predicate, object), where a subject is an IRI or blank node, predicate is an IRI, and object is...

Counting with SPARQL: how to get results in one row?

rdf,sparql,sesame

Does this do the trick? SELECT (COUNT(?c) AS ?cs) (COUNT(?b) AS ?bs) (COUNT(?w) AS ?ws) WHERE { { ?c a :OneThing . } UNION { ?b a :AnotherThing . } UNION { ?w a :ThirdThing . } } ...

Get position of item in rdf type sequence with sparql

sequence,rdf,sparql

You could do this using a REPLACE function to remove the namespace part of the URI, and then casting the result to an integer, like so: PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX uri: <http://example.org/> SELECT (xsd:integer(REPLACE(str(?prop), "http://www.w3.org/1999/02/22-rdf-syntax-ns#_", "")) as ?pos) WHERE { [] a rdf:Seq; ?prop uri:a . }...

RDF file to excel-readable format

rdf,export-to-csv

RDF has a very simple data model: it's just subject predicate object. You can see this by converting your file to n-triples: $ rdfcopy myfile.ttl # apache jena $ rapper -i turtle myfile.ttl # rapper (part of librdf) But this is limited. Suppose you start with the nice looking turtle...

OpenRdf Exception when parsing data from DBPedia

java,rdf,sparql,dbpedia,sesame

To help other users who might encounter the same problem, I'll post here the way to set the preferred output format for Graph Queries using OpenRDF v2.7.x. You need to creat a subclass of SPARQLRepository to access the HTTPClient (for some reason, the field is protected. public class NtripleSPARQLRepository extends...

use of FOPLRelationalModel.MySQLMassLoader

python-2.7,rdf,rdflib

you probably want to have a look at RDFLib SQLAlchemy. It allows you to connect to various databases like mysql, postgres, sqlite... and use them as a Store backend of rdflib....

Datatype dataTime insertion in ontology with SPARQL queries

java,rdf,sparql,jena,ontology

If you print your created query string you should quickly be able to see that it is invalid i.e. System.out.println(qry); The problem is that you haven't put quotes around your date time constant as is required for literals in SPARQL. So your update needs to look more like this: qry...

Sparql Construct on a service

rdf,sparql,semantic-web

I Found the problem and it is due to the TopBraid editor. It is an Issue of spacing. The Where and Construct shoud not have more than two lines that separate them..... There few other corner case of spacing. More generally spacing is important in TopBraid Sparql editor. Hence the...

Can I merge an unknown named graph with an other in a SPARQL query?

syntax,merge,rdf,sparql

There is no standard way to change the dataset beign queried after the query starts. This is especially true if FROM is loading from the web. If you can put all the possible graphs in the datasets, you can use GRAPH. if you can't, then your two step approach is...

How to build a relevent benchmark of queries for database systems comparison?

database,performance,rdf,benchmarking

I finally found this presentation that describe everything one must consider when building a comparative study on database

Single value in where clause

rdf,sparql,ontology,owlim

The dollar sign is a legal variable prefix in SPARQL, so you can use variables like $v, but that doesn't appear to be what's happening. You can have an optional as the only thing within a WHERE, so a query like this is legal: prefix foo: <> prefix bar: <>...

Get value from a SPARQL query

rdf,sparql,semantic-web,rdfa

The simplest way to do this is of course just adding the variable you want to have the values of, ?Ingrediente, to your SELECT clause: SELECT ?r (count(distinct ?Ingrediente) as ?oi) ?Ingrediente (as an aside, you have a variable ?i in there which doesn't seem to do anything - it's...

Trying to understand “expected types” and “type.property.schema” properties in Freebase

rdf,freebase,rdfs

I'm not a freebase user, so I don't have a lot of context for the Freebase specific parts, here, but I can speak about about possible relationships to is expected type equal to rdfs:range? is type.property.schema equal to rdfs:domain? I'd interpret a description like: Definition: The expected type of the...

SPARQL functions in CONSTRUCT/WHERE

rdf,sparql,fuseki

With the help of my colleague we got it to work, UNION and GROUP BY are essential. This query puts the string together for all locah:ArchivalResource in the graphs: CONSTRUCT { ?archresource skos:hiddenLabel ?supertitle } WHERE { SELECT ?archresource (group_concat(?title ; separator = ", ") AS ?supertitle) WHERE { GRAPH...

Reasoning and datatypes of Literals

rdf,owl,reasoning,turtle,stardog

According to the docs: RDF parsing in Stardog is strict: it requires typed RDF literals to match their explicit datatypes, URIs to be well-formed, etc. In some cases, strict parsing isn’t ideal—it may be disabled using the --strict-parsing=FALSE. However, even with strict parsing disabled, Stardog’s RDF parser may encounter parse...

Query multiple models within same Dataset in TDB Jena

rdf,sparql,jena,ontology,tdb

You can make the default graph the union of the named graphs: https://jena.apache.org/documentation/tdb/datasets.html or a subset of the graphs (efficiency issues at very large scale): https://jena.apache.org/documentation/tdb/dynamic_datasets.html...

Resources on OWL and Building Ontologies [closed]

rdf,ontology

There are some nice Protege tutorials which you can use to learn OWL and building ontologies. Here is one example which does exactly what you ask for: https://www.youtube.com/watch?v=MbauHV2-XYw Alternatively, one of the most famous examples for learning OWL concepts is the Pizza tutorial. I haven't found a video, but this...

How to query dbpedia by property type value,

rdf,sparql,semantic-web,dbpedia

<http://dbpedia.org/ontology/Settlement> is the IRI of the type Settlement. Any particular settlement, such as Carter Crest, Edmonton, is an instance of that type. By writing <http://dbpedia.org/ontology/Settlement> ?property ?hasValue you look for properties that are linked to the type Settlement, rather than to any instances of it. What you are looking for...

eclipse jena parsing statement

rdf,jena

The RDFNode object will be either a Literal or a Resource. You can use the same isLiteral() method that you've used on the Predicate to determine which type an object is, and then use the asLiteral() and asResource() methods to perform the necessary conversion. In the case of a Literal,...

Parsing quads with nxparser

eclipse,parsing,rdf,n-triples

I think you were close, based on the commented out bits. String fileInput="c://ex.nq"; StreamRDF streamHandler = new StreamRDF() { @Override void base(String base) {}; @Override void start() {}; @Override void finish() {}; @Override void prefix(String prefix, String iri) {}; @Override void quad(Quad quad) { // Do something with your quad...

Python RDF lib - String value for nodes

python,rdf,rdflib

If you want the string contents of a literal, use str(value). Note that this throws away some information -- the datatype and the language -- that are part of the RDF model. For comparison: lit = rdflib.term.Literal('Literal\nvalue', lang='en') print(str(lit)) print('---') print(lit.n3()) gives: Literal value --- """Literal value"""@en It sounds like...

converting freebase MQL to SPARQL

rdf,sparql,semantic-web,freebase,mql

Max and I had a bit of discussion in a chat, and this might end up being the same approach that Max took. I think it's a bit more readable, though. It gets 15 artists with albums, and up to 5 albums for each one. If you want to be...

Reify triples in JSON-LD

rdf,json-ld

I'm not sure if you really want to assign "a type" to the whole triple, but as you ask for it and mention Reification, you could do something like this: [ { "@id": "http://www.example.com/id/linkFrom", "http://www.example.com/link": [ { "@id": "http://www.example.com/id/linkTo" } ] }, { "@id": "http://www.example.com/reifi/1", "@type": [ "http://www.example.com/vocab#specialLink", "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" ],...

Sparql query not showing results

rdf,sparql,jena,owl,ontology

I think you are forgetting how properties are defined in OWL. You have defined: Class: DiningRoom subClassOf: hasProperty some AbsoluteHumidity Thus, you need to write a more complicated query: PREFIX ssn: <http://purl.oclc.org/NET/ssnx/ssn#> PREFIX dgo: <http://www.iiitd.edu.in/~haroonr/ontologies/DGO#> SELECT distinct * WHERE { dgo:DiningRoom rdfs:subClassOf ?property . ?property owl:someValuesFrom ?y. } ...

How to preserve namespace prefixes in a Jena TDB dataset?

java,namespaces,dataset,rdf,jena

Just so that the answer isn't lost if the comments get deleted, AndyS mentioned that this was discussed on the Jena user's mailing list, and resolved in issue JENA-860, Adding a graph does not add prefixes.

RiotException when loading a Model using Jena 2.12.1

rdf,jena,dbpedia

The problem is that I was trying to access to the resource http://dbpedia.org/resource/Pacific_Rim_(film) which contains a character 0x2013 (Em-dash) that is not legal at that point in Turtle. These are the answers for both questions: I was using Jena 2.12.1 which applies content negotiation and lists Turtle before RDF/XML so...

SPARQL update with optional parts

rdf,sparql,jena

The following seems to work, when the caller sets composition to a blank node if and only if it sets ?composer to an IRI. if (composer != null) { parameterizedSparqlString.setIri ("composer" , composer); parameterizedSparqlString.setParam("composition", NodeFactory.createAnon()); } INSERT { ?performance mo:performer ?performer ; # optional mo:singer ?singer ; # optional mo:performance_of...

How to get Individual name from Node value in Jena RDF Inf Model

java,rdf,sparql,jena,semantic-web

In the following line you're trying to get the the subject, then get a Node version of it, and then get an Individual version of it. System.out.println(st.getSubject().toString() + "****" + pModel.getRDFNode(st.getSubject().asNode()).as(Individual.class)); You're doing this for the subject of every triple in the graph. The documentation for Individual says: In order...

Count resources having a property of a certain type in SPARQL

rdf,sparql

Your data wasn't quite usable (there were no prefixes on the p1, p2, etc., resources), but after fixing that, I was able to use the following query. You were pretty close; the trick is that you need to filter(?p1 != ?p2) to ensure that you're getting different values of the...

Can't definine classes and properties in Stardog

rdf,stardog

Stardog (and thus the web console) limits which parts of the database it obtains the schema information from by default. From the Stardog documentation a database has a reasoning.schema.graphs option which is described as follows: Determines which, if any, named graph or graphs contains the "tbox", i.e., the schema part...

Replace variables within a SPARQL query in Jena

rdf,sparql,jena

You need to use variables, not constants in the query. E.g., your string should originally be: insert data { ?indx :locatedIn ?placx ... } Then you can use the various setXXX functions. However, note that there's more than just setLiteral. You shouldn't use setLiteral to set the value of ?indx...

Date modelling using ontology concepts

rdf,semantics,owl,ontology,protege

If i understand your question correctly, you're essentially asking if you should "duplicate" existing classes and properties from other ontologies into your own one. The clear answer is: no. The semantic web / linked data lives of the re-use of existing vocabularies, so [...] it's best to not re-invent any...

SPARQL - Order By “duplicates”/“rename” property, why?

order,rdf,sparql,semantic-web,virtuoso

The virtuoso version is: 07.00.3203 . Funny enough I have tried the same example in an old virtuoso instance we have for testing (ver: 06.01.3127) and it works perfectly, so it must be a bug. For those who want to replicate the bug, the triples are the following: https://mega.co.nz/#!QldDySoD!vCnGqlYFCA5-jyMzq3GuRH39Kb2nMiUARG752G1pfAs...

Multiple domain and range in objectProperty?

rdf,semantic-web,owl,ontology,rdfs

It's not really clear what the problem is. You can add multiple domains and ranges to object properties, but the interpretation is the intersection. That means that you if say, for instance, hasFather rdfs:domain Son hasFather rdfs:domain Animal whenever you have X hasFather Y you'll be able to infer X...

Freebase rdf API: get rdf triple with a specific tail

google-api,rdf,freebase

The Freebase RDF endpoint only serves up single RDF documents. There is no API associated with it (SPARQL or otherwise). You have three choices: Do your querying using the Freebase MQLRead API (perhaps using the results to retrieve RDF documents if that's the final format that you want). Download the...

librdf compiling error, undefined reference to raptor_new_world_internal'

c++,g++,rdf

Instead of copying your header file, try #include <raptor2/raptor2.h> And compile with g++ test.cpp -lraptor2. You need to link against the library in order to be able to use it....

Sparql query: find objects with same property objects

rdf,sparql

The Solution I'm interested in finding the stores that sell all the CD's :person wants, i.e. (:storeA). Is it possible to get this result with a SPARQL query? Yes, the trick is to do something that matches all the stores, and then filters out those for which there is a...

MarkLogic 8 - What is the Preferred Way to Triplify Data

rdf,marklogic,triplestore,triples

If you do not want to keep the original documents (and enrich them with triples), but instead to store only triples, the easiest is to generate the triples. The preferred way to do this is indeed to generate the sem:triples documents yourself. The key point to take into account is...

SPARQL query to return matches on satisfied restrictions

rdf,sparql,owl

You can do some of what you're talking about, but it's important to remember that OWL is based on open world reasoning. This means that if you haven't explicitly said something, and you don't have a way to infer whether it's true or false, OWL doesn't assume either way; it's...

year() function in SPARQL

rdf,sparql,jena,semantic-web

2007-04-12T00:00+00:00"^^xsd:dateTime isn't a legal xsd:dateTime (the time part should be 00:00:00, not 00:00. Therefore it is not a legal value and year(illegal) is error, and the filter is false.

tdbloader2 fails with classpath error

java,rdf,jena,tdb

I had forgotten to set the JENAROOT path variable. https://jena.apache.org/documentation/tools/ An environment variable JENAROOT is used by all the command line tools to configure the class path automatically for you. You can set this up as follows: On Linux / Mac export JENAROOT=the directory you downloaded Jena to export PATH=$PATH:$JENAROOT/bin...

How to access parent properties of a child class in rdf with sparql?

inheritance,rdf,sparql,semantic-web,rdfs

To complement what Joshua tried to explain you are mixing the schema and data concepts. I think what you should define is (in simplified RDFS syntax): ex:property rdfs:domain ex:myClass1 . ex:property rdfs:range xsd:integer . ex:myClass2 rdfs:subClassOf ex:myClass1. #this may be optional depending on the entailment regime your SPARQL enpoint uses...

Print dateTime without specifying datatype in Sparql output

java,rdf,sparql,jena,ontology

You can use a project expression to just get the string form of the literal: String qr = "PREFIX : <http://www.example.com/tempsensor#>\n" + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \n"+ "SELECT \n"+ "?Place ?Temperature (STR(?Date) AS ?StrDate) \n"+ "WHERE\n"+ "{ ?ind :locatedIn ?Place .\n " + " ?ind :measures ?Temperature .\n " + "...

Fuseki indexed (Lucene) text search returns no results

rdf,sparql,jena,owl,fuseki

If you run the server with ./fuseki-server -v --debug -loc=DB /dataset then it is not using your configuration file. Try: ./fuseki-server --desc text-config.ttl or better have a Fuseki configuration file with service and dataset description (see examples) and run: ./fuseki-server --confg config.ttl ...

multiple users accessing RDF file for read and write

apache,rdf,jena,rdfs

Have a look at the Concurrency HowTo of the Jena website. Follow relevant links for TDB/SDB transactions. According to the documentation: Locks provide critical section support for managing the interactions of multiple threads in the same JVM. Jena provides multiple-reader/single-writer concurrency support (MRSW). The pattern general is: Model model =...

Unexpected End of Stream while trying to tokenise sparql query

rdf,sparql,xml-namespaces

The problem is writing FILTER((\"http://www.w3.org/TR/rdf-schema/#\")<STR(?s)). You can't have a string that is bigger than a namespace. If you want to filter based on a namespace you need to see what the instances that you are filtering start with and then write something like: select distinct * where{ ?s ?p ?o...

How to check if OWLObjectPropertyExpression between classes exists?

rdf,semantic-web,owl,owl-api,reasoning

I can suggest two solutions to your problem: Go through all Bs, but instead check satisfiability of A and (isManagedBy only (not B)). If this expression is unsatisfiable for some B, then such B has to be connected with a given A via isManagedBy. If you are using FaCT++ for...

Add RDFa using my own RDF Schema

rdf,semantic-web,rdfs,rdfa

There are two common ways how to host a vocabulary/ontology: hash namespace (e.g., http://example.com/vocabulary#Person) slash namespace (e.g., http://example.com/vocabulary/Person) The W3C Working Group Note Best Practice Recipes for Publishing RDF Vocabularies contains some recipes, which illustrate example configurations. Let’s assume that you go with a hash namespace, so that the complete...

Json to RDF/XML file in Python

python,xml,json,rdf

This will tranlsate your json object to xml import simplejson content = simplejson.loads(YourJsonObject) from xml.etree.ElementTree import Element from xml.etree.ElementTree import tostring def dict_to_xml(tag, d): ''' Turn a simple dict of key/value pairs into XML ''' elem = Element(tag) for key, val in d.items(): child = Element(key) child.text = str(val) elem.append(child)...

How to add jena rule to OntModel

java,rdf,jena,semantic-web

Andy's answer captures the most important parts here: when you define a rule-based inference model, the contents of the model are the asserted and inferred triples; the rules aren't written into the model. The rules are part of the reasoner, not the data. This is actually in contrast to SWRL...

Connect Topbraid Composer to Stardog with Sesame

rdf,sparql,sesame,stardog,topbraid-composer

Stardog does not support the Sesame HTTP API. If there is a way to connect TopBraid to a database via the SPARQL protocol, I suggest using that option.

What is the difference between XMLSchema and RDFSchema?

xml,xsd,rdf,rdfs

Yes, that's basically correct. XML Schema is for the definition of XML documents in general. It provides the eXtensibility in XML (eXTensible Markup Language), much like DTDs have done, but with improvements to typing and an XML-based syntax. RDF Schema provides a data-modelling vocabulary for RDF (Resource Description Framework) data....

SPARQL query restric answer

rdf,sparql,ontology

There's no connection between the variables ?r and ?m: ?r rec:Ingrediente ?Ingrediente. ?m rdf:type rec:ModoPreparacion. This says "find (a recipe) ?r with an ingredient ?Ingrediente and an ?m with type rec:ModoPreparacion." That means that you find every possible combination. Compare with data like: :John a :Person; :hasAge 30 . :Bill...

sparql rdf fuseki how can i filter date in graph name

rdf,sparql,fuseki

It's easier when we have actual data to work with. Please be sure to provide data that we can work with in the future. For this case, I've just bound the URIs with embedded date times to the ?dateUri variable using a values block. The comments in the query explain...

SPARQL Group-Concat not working

rdf,sparql,jena

It's always helpful if you can show the query and the data complete and on their own, not just snippets and embedded in code. Here's some complete data that we can test with: <rdf:RDF xmlns:ns0="http://my.url.com/ontologies/mash-up#" xmlns:ns1="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <ns0:CalendarItem rdf:about="http://my.url.com/ontologies/mash-up#CalendarItem-uh0cjvnuehhvfjpgppiggmpjac"> <ns0:attendee...

Convert OWL/XML in RDF/XML with a simple command line in shell

java,shell,rdf,owl,owl-api

To change a entire repository of an OWL/XML file into RDF/XML file: 1- create your package owl2rdf.java package owl2rdf; //import all necessary classes import java.io.File; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.io.RDFXMLOntologyFormat; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyManager; @SuppressWarnings("deprecation") public class owl2rdf { #create a main() function to take an argument; here in...

sparql - use of curly braces

rdf,sparql,semantic-web

In many cases, there is no difference In the examples that you gave, there's no difference. This is actually called out in the specification: 5.2 Group Graph Patterns In a SPARQL query string, a group graph pattern is delimited with braces: {}. For example, this query's query pattern is a...

How to define the type of elements in an rdf:Seq?

syntax,rdf,owl,rdfs,turtle

There are probably a number of ways to accomplish this, depending on your implementation preferences. My advice is to use the rdf:li special property in place of the arbitrary rdf:_nnn, which is easier to extend. rdf:li is equivalent to rdf:_1, rdf:_2 in order. So the following code blocks are equivalent:...

Represent class and properties with RDFS

xml,rdf,semantic-web,rdfs

But I'm not sure, I'm confused between domain and range. When a property p has a domain D, it means that whenever you have a triple x p y then x is an instance of D. When a property p has a range R, it means that whenever you...

querying RDFs using SPARQL query

sql,rdf,sparql,virtuoso

You can transform the URI into a string and then filter based on what it starts with. The keyword you need to use is STRSTARTS: select distinct * where{ ?s ?p ?o filter(STRSTARTS(str(?s), "http://test.com/")) } or you can use regular expressions with the ^ sign: select distinct * where{ ?s...

Writing a Jena rule to add properties to a resource with some specific property values?

java,rdf,jena,rule

The second rule is wrong Your second rule is broken because there's no connection between the value of the d2 and d3 variables: [AdaptedModel: (?d2 rdf:type perSys:NetworkCharacteristics), (?d2 perSys:Bandwidth '450'^^xsd:float) (?d3 perSys:SpecificLocation ?a) -> (?d3 perSys:AdaptedSpecificLocation ?a)] This roughly says: If some X has type NetworkCharacterstics and has bandwidth 450,...

Enter values from a list into a sparql query

java,list,rdf,sparql

Assuming your list is a simple List of Strings, this becomes just basic Java programming, and you can very easily do this by writing a method that takes a List<String> as input, and outputs the list as a string in SPARQL syntax. For example: String convertToSPARQLList(List<String> list) { StringBuffer sb...

How to model a class that is a collection of individuals of another class in Protege

rdf,owl,ontology,protege,swrl

Is there any other way to do this without use of user defined object property with minimum cardinality? You will need to define some sort of membership property. It can be generic (e.g., hasMember), or more specific to the particular type (e.g., hasLion), but you'll need to define something...

main class exception when running db2triples for the first time

java,maven,rdf,db2triples,r2rml

The error means that when you run db2triples, it can't find a dependency that is needed. One way to resolve this problem is to add the required dependencies to your class path. Is the apache commons cli jar actually sitting in target/dependencies? Another way to resolve this is to build...

DISTINCT only on one value with SPARQL

rdf,sparql,dbpedia,linked-data

You can use GROUP BY to group by a specific column and then use the SAMPLE() aggregate to select one of the values from the other columns e.g. PREFIX dbo: <http://dbpedia.org/ontology/> SELECT ?city (SAMPLE(?name) AS ?cityName) (SAMPLE(?pop) AS ?cityPop) WHERE { ?city a dbo:Settlement . ?city foaf:name ?name . ?city...

java getRuntime().exec() with redirection

java,rdf,jena,runtime.exec

Runtime.exec is obsolete and really shouldn't be used for anything anymore. Its replacement is ProcessBuilder. You don't have to quote or escape anything when you use it: ProcessBuilder builder = new ProcessBuilder( "java", "-jar", "filePath/rdfslice_1.6.jar", "-source", "filePath/myData.nt", "-patterns", "{?s1 <http://www.europeana.eu/schemas/edm/isShownAt> ?o1.}", "-out", "filePath/output.out", "-order", "S"); Process p = builder.inheritIO().start(); ...