Deleting in SailGraph - graph

I am trying to delete a vertex in SailGraph. This works locally but not on the server. On the server the underlying neo4j database is left inconsistent.
graph = GraphFactory.createGraph(config.get("type").getAsString(),
name, dbpath);
sail = new GraphSail<KeyIndexableGraph>(graph);
sailGraph = new SailGraph(sail);
reasoner = new ForwardChainingRDFSInferencer(
new GraphSail<KeyIndexableGraph>(graph));
This is what i use to initialise then I load an RDF
public static void loadRDF(InputStream is, String baseURI, String format,
sailGraph.loadRDF(is, baseURI, format, baseGraph);
To remove I use
Vertex vertex = sailGraph.getVertex(uri);
vertex.remove();
Locally it works on the server it goes past the remove step but the vertex is still there. No exceptions or anything. I have set the permissions on the database directory to allow writing but still nothing. Any ideas?
Thanks

Related

Ignition SDK Gateway configuration shows path, not string

I am trying to program a MODULE for the Ignition SDK but I am running into problems with the paths of the strings in the .properties file not working properly.
I have a file called
ProfileSettings.properties
and one called
ProfileSettings.java
In .properties file, I have the following strings:
Category.Settings=Connection
ConnectionString.Name=Connection String
ConnectionString.Desc=Connection String for the IoT Hub device
MaxTime.Name=Maximum time
MaxTime.Desc=The time spent
MaxMessages.Name=Maximum to collect
MaxMessages.Desc=will be collected
and in the .java file, I have reference to the strings by using
public static final StringField connectionString = new StringField(META, "ConnectionString");
public static final IntField maxTime = new IntField(META, "MaxTime");
public static final IntField maxMessages = new IntField(META, "MaxMessages");
Category CONNECTION_CATEGORY = new Category("ProfileSettings.Category.Connection", 1001)
.include(connectionString, maxTime, maxMessages);
but when I load the module into the gateway and look at the configuration page, I get ¿ProfileSettings.ConnectionString.Name? where it shows question marks
around the path and not the actual text needed for all the strings
Maybe try using the complete field names?
public static final StringField connectionString = new StringField(META, "ConnectionString.Name");
Or possibly
public static final StringField connectionStringName = new StringField(META, "ConnectionString.Name");
It would be helpful to have more information about what and where those files are from. Is the .properties file or properties.java something you wrote or is that something that comes as part of the SDK?

virtual path change

I want to change Virtual Path(The path is out of project means local system or Server.) of the file Which is save on the folder in asp.net.
Code is
DataTable dtFiles =
GetFilesInDirectory(HttpContext.Current.Server.MapPath(UPLOADFOLDER));
gv.DataSource = dtFiles;
gv.DataBind();
if (dtFiles != null && dtFiles.Rows.Count > 0)
{
double totalSize = Convert.ToDouble(dtFiles.Compute("SUM(Size)", ""));
if (totalSize > 0) lblTotalSize.Text = CalculateFileSize(totalSize);
}
private static string UPLOADFOLDER = "D:/Uploads";
And the error show "D:/Uploads is not a valid virtual path.".
If you want to get the files in a directory and you know the full path, then you don't need to use Server.MapPath(). Just use the path.
Incidentally, the path delimiter is incorrect in your code. The string "D:/Uploads" should be #"D:\Uploads" (note the leading # sign to denote a string that should be treated literally and not escaped).
Of course. You're telling your server to map path that is completely off the IIS. How is it supposed to do? If you're using a web application, try to avoid such ideas completely. Even though it is possible, it isn't a good idea because of security issues you can run into.

Blackberry - Cannot create SQLite database

I am making an app that runs in the background, and starts on device boot.
I have read the docs, and have the SQLiteDemo files from RIM, and I am using them to try create a database on my SD Card in the simulator.
Unfortunately, I am getting this error:
DatabasePathException:Invalid path name. Path does not contains a proper root list. See FileSystemRegistry class for details.
Here's my code:
public static Database storeDB;
public static final String DATABASE_NAME = "testDB";
private String DATABASE_LOCATION = "file:///SDCard/Databases/MyDBFolder/";
public static URI dbURI;
dbURI = URI.create(DATABASE_LOCATION+DATABASE_NAME);
storeDB = DatabaseFactory.openOrCreate(dbURI);
I took out a try/catch for URI.create and DatabaseFactory.openOrCreate for the purposes of this post.
So, can anyone tell me why I can't create a database on my simulator?
If I load it up and go into media, I can create a folder manually. The SD card is pointing to a folder on my hard drive, and if I create a folder in there, it is shown on the simulator too, so I can create folders, just not programatically.
Also, I have tried this from the developer docs:
// Determine if an SDCard is present
boolean sdCardPresent = false;
String root = null;
Enumeration enum = FileSystemRegistry.listRoots();
while (enum.hasMoreElements())
{
root = (String)enum.nextElement();
System.err.println("root="+root);
if(root.equalsIgnoreCase("sdcard/"))
{
sdCardPresent = true;
}
}
But it only picks up store/ and never sdcard/.
Can anyone help?
Thanks.
FYI,
I think I resolved this.
The problem was I was trying to write to storage during boot-up, but the storage wasn't ready. Once the device/simulator was loaded, and a few of my listeners were triggered, the DB was created.
See here:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/832062/How_To_-_Write_safe_initialization_code.html?nodeid=1487426&vernum=0

"Unable to open database file" using SQLite on Windows Phone 7

I am using SQLite for Windows Phone 7 (http://sqlitewindowsphone.codeplex.com/) and I have done every steps from this tutorial (http://dotnetslackers.com/articles/silverlight/Windows-Phone-7-Native-Database-Programming-via-Sqlite-Client-for-Windows-Phone.aspx)
Then I try to make some simple application with basic features like select and delete. App is working properly till I want to make one of this operations. After I click select or delete, compiler shows me errors that he is unable to open database file...
I have no idea why?
I used the same Sqlite client, and had the same problem. This problem occurs because the sqlite try to create file in IsolatedFileStorage "DatabaseName.sqlite-journal" and it does not have enough permissions for that. I solved the problem, so that created "DatabaseName.sqlite-journal" before copying database to IsolatedFileStorage. Here's my method that did it:
private void CopyFromContentToStorage(String assemblyName, String dbName)
{
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
string uri = dbName + "-journal";
store.CreateFile(uri);
using (Stream input = Application.GetResourceStream(new Uri("/" + assemblyName + ";component/" + dbName,UriKind.Relative)).Stream)
{
IsolatedStorageFileStream dest = new IsolatedStorageFileStream(dbName, FileMode.OpenOrCreate, FileAccess.Write, store);
input.Position = 0;
CopyStream(input, dest);
dest.Flush();
dest.Close();
dest.Dispose();
}
}
it helped me, and worked well.
hope this will help you
Are you sure the file exists?
You can check like that:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
exists = store.FileExists(DbfileName);
}

strore a xml file in registry and after restore it

I want strore a xml file in registry and after restore it.Do it possible?
i try create with this code But it Not Responding?!what is problem?
enter code here
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
List<int> f = new List<int>();
f.Add(4);
formatter.Serialize(stream, f);
byte[] binary = stream.ToArray();
string yu = Encoding.UTF8.GetString(binary);
RegistryKey key = Registry.Users;
RegistryKey key2 = key.OpenSubKey(".DEFAULT", true);
key2.SetValue("my4",yu,RegistryValueKind.String ); // "why writed empty string in registry
}
}
A few remarks on this:
1: The registry isn't the right place to save a whole XML file. More normal might be to save the xml to the filesystem and possibly save its location in the registry.
2: Registry.Users refers to a location in the registry where you wouldn't normally save data. Either it should be in HKey_Current_User (Registry.CurrentUser) or HKey_Local_Machine (Registry.LocalMachine) depending on whether the data is specific to all users on the PC or just the current user.
3: I'm extremely confused about what the coding in the first two questions is trying to achieve. Its a long way around to make a string, the contents may not be compatible with the registry and I can see anything related to XML.
I would make a strong warning that updating the registry without knowing exactly what you're doing is very dangerous. It could easily lead to odd errors or even a non-booting PC. Only proceed with trying registry updates once you fully understand how it works. I would start with an article like this one and read on from there.

Resources