Hi Suat,
Am 04.09.2012 16:27, schrieb Suat Gonul:
Hi Melanie,
While submitting content items from CMS to Contenthub, the identifiers
of the items in the CMS are used.
ah, I see, that's where the urn:content-item-{} comes from. Sorry, I
thought the ids were assigned by the contenthub like in creating content
items without a user-specified id. I think the documentation hints to
this circumstance in the paragraph:
"If|id|parameter is set, the target object is obtained from the content
repository according to its ID. If|path|parameter is set, first the ID
of target object is obtained from the content repository and then the
retrieved ID is used in submission of content item."
(/cmsadapter/contenthubfeed#)
So this means then that I can submit items by knowing only their path,
but in order to fetch them back I need to also know their id. Ok.
thanks a lot
Melanie
The same id can be used to fetch
documents from Contenthub. To get identifier of a JCR node you can use
Node#getIdentifier() method.
If you remove the nodes from CMS and create same nodes in same paths
their identifiers are changed. After that if you resubmit them to
Contenthub, new ContentItems are created (I think this is the case for
you). However, if you don't remove the items in the CMS but only update
them and then do the resubmission, the existing ContentItems will be
overwritten.
You can update an item in the Jackrabbit using a code snippet as follows:
Node testNode = rootNode.getNode("test");
Node jcrContent =
testNode.getNode("news1.txt").getNode("jcr:content");
File f = new File(
"/home/suat/Desktop/technicalStuff/stanbolTests/cmsAdapter/jackrabbit/news3.txt");
Binary binary = session.getValueFactory().createBinary(
new FileInputStream(f));
jcrContent.setProperty("jcr:data", binary);
session.save();
Best,
Suat
On 09/03/2012 12:27 PM, Melanie Reiplinger wrote:
Hi again Suat,
sorry, I have to be more accurate here: when re-submitting, a new item
is only created on the contenthub if the repo item has changed, e.g.
if its document file contains a new or additional sentence. So there
are no simple duplicates of repo items, but new items for updated
versions of the same item.
Am 03.09.2012 10:54, schrieb Melanie Reiplinger:
Hi Suat,
ok, I will retry deletion later.
In the meantime - is it possible to submit a content repo item under
a specific urn to the contenthub? If I re-submit the same items, they
are stored under the same title, but with different urns. In order to
get a specific document back from the contenthub, I always used an id
that I specified at creation. Can I also specify a urn for my repo
items when submitting them via contenthubfeed? I know that this might
be problematic when submitting subtrees recursively, because then
only the root node would have the corresponding urn, but it would
also prevent me from re-submitting the same subtree over and over
again. Btw, the POST does not return the content-id like it does on
the contenthub, so if I don't specify an id at submission, I won't be
able to fetch the item back from the contenthub.
One more thing: suppose the deletion worked - would then all the
duplicates of my content item on the contenthub (created by duplicate
submission of the same subtree) be deleted at once ? (since the
deletion works by path or id which the item has in the content repo)
Thanks,
Melanie
Am 31.08.2012 14:27, schrieb Suat Gönül:
Hi Melanie,
The deletion problems seems to be related with the bug described in
STANBOL-727. Could you please retry after that bug is fixed?
Best,
Suat
On Thu, Aug 30, 2012 at 1:00 PM, Melanie Reiplinger <
[email protected]> wrote:
Hi Suat,
thank you a lot for demonstrating this. It seems my mistake was
that I did
not associate files with the nodes. For no specific reason I
assumed that
files would be created when the nodes were created. But then I
guess that
usually, it's the other way around: when building a repo, the files
are
already there and are then are used to build up the tree.
Now how do you delete your 2 content items from the contenthub? The
documentation says it's the very same syntax as for submitting
items, just
using DELETE instead of POST, but that gives me a Bad Request with
java.lang.**IllegalArgumentException: No content found for any of the
following parameters [entity, content].
It does also not work in the REST interface.
Best,
Melanie
Am 27.08.2012 13:42, schrieb Suat Gonul:
Hi Melanie,
It is true that a content repo is needed to run unit tests. Anyway, I
tested the Jackrabbit and I shall share the steps with you. I hope
they
would work for you too.
First of all, I was able to create nodes in Jackrabbit through the
JCR
API.
- I ran the jackrabbit-standalone-2.4.2.**jar on the 8080 port.
- Then created temporary nodes with the following code below. The
code
create two nodes to be submitted to the Contenthub under the "test"
path. The nodes are associated with two files from the local file
system. So, you should adapt the file paths. 3 external libraries are
required to run this code: jackrabbit-jcr-rmi-2.2.*.jar,
jcr-2.0.jar and
slf4j-api-*.jar. They are already downloaded when you build
Stanbol into
the maven repository i.e the .m2 folder.
Repository repository = new URLRemoteRepository(
"http://localhost:8080/rmi");
Session session = repository.login(new
SimpleCredentials("admin",
"admin".toCharArray()));
Node testNode = null;
try {
testNode = session.getNode("/test");
testNode.remove();
} catch (PathNotFoundException e) {
// ignore
}
Node rootNode = session.getRootNode();
testNode = rootNode.addNode("test");
File f = new File(
"/home/suat/Desktop/**technicalStuff/stanbolTests/**
cmsAdapter/jackrabbit/news1.**txt");
Node newsNode = testNode.addNode(f.getName(), "nt:file");
Node resourceNode = newsNode.addNode("jcr:content"**,
"nt:resource");
resourceNode.setProperty("jcr:**mimeType", "text/plain");
Binary binary = session.getValueFactory().**createBinary(
new FileInputStream(f));
resourceNode.setProperty("jcr:**data", binary);
f = new File(
"/home/suat/Desktop/**technicalStuff/stanbolTests/**
cmsAdapter/jackrabbit/news2.**txt");
newsNode = testNode.addNode(f.getName(), "nt:file");
resourceNode = newsNode.addNode("jcr:content"**,
"nt:resource");
resourceNode.setProperty("jcr:**mimeType", "text/plain");
binary = session.getValueFactory().**createBinary(new
FileInputStream(f));
resourceNode.setProperty("jcr:**data", binary);
session.save();
- I ran the Stanbol on 8081 and executed the following commands:
- curl -X GET -H "Accept: text/plain"
"http://localhost:8081/**cmsadapter/session?**repositoryURL=http://**
localhost:8080/rmi&username=**admin&password=admin&**connectionType=JCR<http://localhost:8081/cmsadapter/session?repositoryURL=http://localhost:8080/rmi&username=admin&password=admin&connectionType=JCR>
"
- curl -i -X POST --data
"sessionKey=e92be985-e722-**419f-a1ad-5fe02628b537&path=/**
test&recursive=true"
http://localhost:8081/**cmsadapter/contenthubfeed<http://localhost:8081/cmsadapter/contenthubfeed>
In the second command the result of the first command should be used.
After executing these commands, I was able to see documents on
http://localhost:8081/**contenthub/contenthub/store<http://localhost:8081/contenthub/contenthub/store>
.
Best,
Suat
On 08/20/2012 01:11 PM, Melanie Reiplinger wrote:
Hi Suat,
Thanks for your reply.
Am 20.08.2012 11:55, schrieb Suat Gönül:
Hi Melanie,
Sorry, I could not answer you as I was in holiday. I will start to
work on
August 27. In my demonstration, I was using CRX CMS.
That seems to be commercial software. I Cannot use that. So I'll
have
to find another way. Under these conditions, I'm not even sure it
makes much sense to create unit tests for the JavaScript
interface to
the cmsadapter, since whoever wanted to run them would need to
have a
content repo locally installed to connect stanbol to it. It makes
sense only if I could set up (or use) a remote repo that's
accessible
from wherever the test script is called...
Best,
Melanie
But to connect CRX, I
have and additional bundle to be added to the OSGi environment.
I can
provide you that bundle when I'm back.
I did not access to the repo via HTTP. In my demonstration, a
session is
obtained together with a session key after giving the necessary
credentials
e.g username, password, rmi endpoint. And that session key is
used by
CMS
Adapter to access to the repo.
Best,
Suat
On Mon, Aug 20, 2012 at 12:11 PM, Melanie Reiplinger <
[email protected]> wrote:
Hi Suat,
I cannot access my jackrabbit repo via xmlhttp either (although
curl
works
fine), so this might as well be a CORS access problem. In your
demo,
did
you have to somehow provide access to the repo (by setting headers
etc)?
Best,
Melanie
Am 15.08.2012 11:15, schrieb Melanie Reiplinger:
Hi Suat,
Am 13.08.2012 13:35, schrieb Suat Gonul:
In any case, I guess that you
need to configure a RDF Bridge through the
{stanbol}/system/console/****configMgr interface. There you
should
find
the
"Apache Stanbol CMS Adapter Default RDF Bridge
Configurations". In
that
configuration you specify the root path in the CMS to be
exported
to the
RDF.
by that you mean the content repository path? This means
that I set
there the path to my content repository?
Yes, you set there a path residing in the content repository.
I have set up a jackrabbit workspace with some toy nodes
in it. To
access it remotely, I'd configure something like
http://[myserver]/server/
<http://lnv-89012.dfki.uni-sb.****de:9002/server/default/**node1<
http://lnv-89012.dfki.**uni-sb.de:9002/server/default/**node1<http://lnv-89012.dfki.uni-sb.de:9002/server/default/node1>
,
but then
I can work with this repository exclusively, right?
I cannot access the URL you gave, but I guess you
should give
/node1
path to export it as RDF. I didn't get your question about
working
exclusively with the repository. But, you already seem to
work on the
default repository of Jackrabbit running on your server.
I tried with several paths, none will work.
My remote repository stub is
http://lnv-89012.dfki.uni-sb.****de:9002/rmi<http://lnv-89012.**
dfki.uni-sb.de:9002/rmi
<http://lnv-89012.dfki.uni-sb.de:9002/rmi>>
.
(you cannot access those URIs because they are in a closed
network)
For accessing the content repository, I should use (according
to my
jackrabbit guidelines):
http://lnv-89012.dfki.uni-sb.****de:9002/server<http://lnv-**
89012.dfki.uni-sb.de:9002/**server<http://lnv-89012.dfki.uni-sb.de:9002/server>
to
access all workspaces of myJCR repository
http://lnv-89012.dfki.uni-sb.****de:9002/server/default/jcr:****
rootto<http://lnv-89012.dfki.**uni-sb.de:9002/server/default/**
jcr:rootto<http://lnv-89012.dfki.uni-sb.de:9002/server/default/jcr:rootto>
access
a single workspace (example with workspace named 'default').
-> this
one is also where I can navigate to with my browser, so this
should
then be
the correct path I guess.
But I always get the same error about
org.apache.stanbol.cmsadapter.****jcr.mapping.JCRRDFMapper
Failed to
retrieve node having path: <thePath> or its childr
I'm an absolute beginner with content repositories, using
jackrabbit for
the first time and I'm really unsure of what would have to
work if
everything was correct, but I can see my repository in the
jackrabbit
console and I also can see that my nodes are existing, and the
info
command
tells me that everything looks like I would expect:
Repository:
http://lnv-89012.dfki.uni-sb.****de:9002/rmi<http://lnv-89012.**
dfki.uni-sb.de:9002/rmi
<http://lnv-89012.dfki.uni-sb.de:9002/rmi>>
User : admin
Workspace : default
Node : /
I looked at your paper ("Semantic Content Management with Apache
Stanbol") and saw that you used jackrabbit in the demo, too. Is
there some
publicly accessible repository I could use for testing (so that I
see what
the path I have to specify looks like in a working example)?
best,
melanie