How to link specific objects to RDF subjects? - mapping

I want to describe a publication object along with all of its properties using some ontologies.
The ontologies that I chose to use are: dc, foaf, cito, dct, bibo.
So far this what I have done:
#prefix dc: <http://purl.org/dc/elements/1.1/> .
#prefix db: <http://lpis.csd.auth.gr/> .
#prefix foaf: <http://xmlns.com/foaf/0.1/> .
#prefix cito: <http://purl.org/net/cito/> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix dct: <http://purl.org/dc/terms/> .
#prefix bibo: <http://purl.org/ontology/bibo/> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix map: <http://lpis.csd.auth.gr#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix vocab: <http://localhost:2020/vocab/resource/> .
#prefix publ <http://ebiquity.umbc.edu/ontology/publication.owl> .
#prefix atr: <http://localhost:8890/rdfv_pt/schemas/authors#> .
#prefix kwrd: <http://localhost:8890/rdfv_pt/schemas/keywords#> .
#prefix pub: <http://localhost:8890/rdfv_pt/schemas/publications#> .
#prefix ref: <http://localhost:8890/rdfv_pt/schemas/references#> .
#prefix rig: http://localhost:8890/rdfv_pt/schemas/rights#> .
pub:Publication a bibo:Article .
pub:PublicationID a dc:identifier .
pub:PublicationTitle a bibo:title .
pub:MediaType a bibo:presentedAt .
pub:publicationType a bibo:presentedAt .
pub:MediaTitle a bibo:title .
pub:MediaPublisher a bibo:issuer .
pub:MediaEditors a bibo:editorList .
pub:MediaVolInfo a bibo:volume .
pub:PublicationYear a bibo:date .
The properties that I haven't been able to describe with the ontologies above are the following:
PublicationNoOfPages(Number of pages that the publication has)
PublicationPagesInMedium (How many pages the publication occupied in a medium e.g. the book in which the article was published)
PublicationFileName (The file name of the article e.g. pub.pdf)
PublicationComments (Comments that other people made for the article)
PublicationRelatedURL (Related URL of the article)
PublicationRelatedURLText (Pretty much the same with the above only in string type)
PublicationLocation (Where AND when the article was published)
PublicationPubURL (URL of the article which was uploaded in a specific conference)
DisplayOnMLKD (This basically a true/false value of whether or not it was displayed on a specific conference)

Related

How to fix custom function class not registered in apache jena fuseki error?

I need a custom filter function in apache-jena-fuseki. I tried adding custom function class name to config.ttl. I added function class files to class path. But it's always throwing error that function is not registered.
Can anyone please share a detailed approach I can try or some documentation? Desperately need it.
Added following line To Configuration File
[] ja:loadClass "org.apache.jena.sparql.function.library.function" .
Class file is in folder /home/user/custom_functions/
Class file package name = org.apache.jena.sparql.function.library.
Java command to launch fuseki server is
java -cp /home/user/custom_functions/function.class:/home/user/apache-jena-4.5.0/lib-src/*:/home/user/apache-jena-4.5.0/lib/* -jar fuseki-server.jar
Function takes one argument.
When I run query, it gives me error log that function has not registered FunctionFactory.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX java: <http://www.w3.org/2007/uwa/context/java.owl#>
PREFIX f: <java:org.apache.jena.sparql.function.library.>
SELECT ?s ?o {
?s rdfs:label ?o .
FILTER (f:function(?o) ) .
}

Converting using ImageMagick creates 2 images of the same

I'm converting images into different sizes using ImageMagick. The conversion works OK, but there are some files that are converted twice.
For example, i'm converting a filename rj54c124a4cb96b3.56843124.tif into jpg using the suffix small.
The conversion works OK but i'm getting two of the same, like so: rj54c124a4cb96b3.56843124_small-0.jpg and rj54c124a4cb96b3.56843124_small-1.jpg
It adds a number after the suffix! Why? Like i've said, out of 3000 files, it only does that to a couple.
EDIT:
As per Keith Thompson question, here's the script im using in PHP
$file = 'c:/website_gallery/rj54c124a4cb96b3.56843124.tif';
$output = 'c:/public_html/gallery/files/4/2/rj54c124a4cb96b3.56843124_small.jpg';
$operator = '-resize'; // in some cases i will use -thumbnail
$width = 125;
$height = 125;
$flag = '^>'; // for localhost; use \> for live host server
exec('convert' . ' ' . $file . ' ' . $operator . ' ' . $width . 'x' . $height . $flag . ' ' . $output, $debug, $return);

Perform an INSERT in Jena Fuseki with SPARQL gem (Ruby)

So I'm developing an API in Rails and using Jena Fuseki to store triples, and right now I'm trying to perform an INSERT in a named graph. The query is correct, since I ran it on Jena and worked perfectly. However, no matter what I do when using the Rails CLI, I keep getting the same error message:
SPARQL::Client::MalformedQuery: Error 400: SPARQL Update: No 'update=' parameter
I've created a method that takes the parameters of the object I'm trying to insert, and specified the graph where I want them.
def self.insert_taxon(uri, label, comment, subclass_of)
endpoint = SPARQL::Client.new("http://app.talkiu.com:8030/talkiutest/update")
query =
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix gpc:<http://www.ebusiness-unibw.org/ontologies/pcs2owl/gpc/>
prefix tk: <www.web-experto.com.ar/ontology#>
INSERT DATA {
GRAPH <http://app.talkiu.com:8030/talkiutest/data/talkiu> {
<#{uri}> a owl:Class.
<#{uri}> rdfs:label '#{label}'#es .
<#{uri}> rdfs:comment '#{comment}' .
<#{uri}> rdfs:subClassOf <#{subclass_of}> .
}
}"
resultset = endpoint.query(query)
end
As you can see, I'm using the UPDATE endpoint. Any ideas? Thanks in advance
Well... Instead of endpoint.query, I tried
resultset = endpoint.update(query)
and worked. Method returned
<SPARQL::Client:0x2b0158a050e4(http://app.talkiu.com:8030/talkiutest/update)>
and the data is showing up in my database and graph. Hope this helps anyone with the same problem.

Configuring Jena Fuseki + inference and TDB?

I am new to Jenna TDB and Fuseki. I would like to load Lehigh University Benchmark (LUBM) data generated with their data generator (ver.1.7) in to Fuseki. This is about 400 .owl files. used the following Configuration file, that comes with Fuseki for inferencing:
<#service1> rdf:type fuseki:Service ;
fuseki:name "inf" ; # http://host/inf
fuseki:serviceQuery "sparql" ; # SPARQL query service
#fuseki:serviceUpdate "update" ;
fuseki:serviceReadWriteGraphStore "data" ;
# A separate read-only graph store endpoint:
fuseki:serviceReadGraphStore "get" ;
fuseki:dataset <#dataset> ;
.
<#dataset> rdf:type ja:RDFDataset ;
ja:defaultGraph <#model_inf> ;
.
<#model_inf> a ja:InfModel ;
ja:baseModel <#tdbGraph> ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
] .
<#tdbDataset> rdf:type tdb:DatasetTDB ;
tdb:location "myDB" ;
tdb:unionDefaultGraph true ;
.
<#tdbGraph> rdf:type tdb:GraphTDB ;
tdb:dataset <#tdbDataset> .
Fuseki starts without any issues. However when I execute the following command:
./s-put http://localhost:3030/inf/data default ~/Owl/univ-bench.owl
I get the an error:405 HTTP method PUT is not supported by this URL http://localhost:3030/inf/data?default
I have couple of questions:
1.The update in the config file is clearly not disabled, so why do I get this message.
2.In order to load all the 400 .owl file as one graph apparently I have to disable the update and enable tdb:unionDefaultGraph true(This is mentioned in the config file that came with Fuseki) if that is the case how on earth am I suppose to load the data to Fuseki.
Please let me know what am I missing here and how I can do this correctly.
Thanks in advance for the help.
Edit: I found out that you will need to add the following:
fuseki:serviceReadWriteGraphStore "data" ;
# A separate read-only graph store endpoint:
fuseki:serviceReadGraphStore "get" ;
in order to be able to use s-put to load data, however every time I add a new file it overwrites the data from the previous file and therefore the inferencing doesn't work. What did I do wrong here? How do I load the data correctly that all the files are loaded to the same graph and inferencing work?
Edit
So digging more in to this problem I found out that there are two ways to load the data.
you can add the following where you define the model in the config file:
ja:content [ja:externalContent <file://// Path_to_owl_file >] ;
So for me I added it under <#model_inf> a ja:InfModel ; However, if you have 400 files that will be really tedious.
You can separately loaded the data using tdbloader2 and point the config file to the directory that the tdbload builds as a database. Which is also described here
$ tdbloader2 --loc tdb PATH_TO_DIR_or_OWL_Files
The issue currently is that when I run a simple query for instance the following query I get a Out of memory error.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ub: <http://cs.uga.edu#>
SELECT *
WHERE
{
?X rdf:type ub:GraduateStudent .
?X ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse0>
}
I increased the memory for Fuseki-Server (int the server script) to up to 5GB and still get a out of memory error for this simple query. Any idea why that might be happening?
s-put does a PUT - which is defined to be a "replace contents".
Use s-post to add to a graph.
LUBM is sufficiently simple in structure that (1) it is not very realistic and (2) inference can be applied to each university alone and the data loaded so at query time, it has all been expanded.

Ruby on Rails - FCKEditor Absolute Image Path Ruby

I am using the FCKEditor wysiwyg editor, and was wondering if anyone figured out how to use the absolute path instead of relative path after you add an image in the editor?
And if so, how.
Search for this code in fckeditor\editor\filemanager\browser\default\connectors\php\basexml.php:
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;
Replace it with this:
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="'.'http://www.YOURDOMAINHERE.com' .ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder ) ) . '" />' ;

Resources